Action Figure Hunt Tech Goes to Orlando Microsoft Ignite Conference | Part 1


Advertisements

Decreasing Indentation of Visual Studio Lines


There are a few articles already out on the Internet, but every time I need them, it takes me forever to find them (have you heard of bookmarks?). I decided to write my own post so I know I’ll always be able to find it.

Scenario

I’ve just copied and pasted about 100 lines of PowerShell code to a script I’m writing, but the indentation is way too far in for this. I’d love to just select all of it and use a key combo like indenting.

Solution

The solution is easy, just use this key combo

Shift + Tab

That’s it! Why can I never remember this? Now I don’t have to. I just need to remember I wrote this article.

So You’re Taking This Away From Me?


On April 8th 2016, I got the below e-mail from Microsoft.

The amount of free storage is changing.
Having trouble viewing this message? Click here.
OneDrive
Important changes to OneDrive
We want to inform you about some upcoming changes to OneDrive that will affect you. In approximately 90 days, the amount of storage that comes with OneDrive will change from 15 GB to 5 GB. We are also discontinuing the 15 GB camera roll bonus. As a result of these changes, you will be over your OneDrive storage limit on July 13, 2016 (visit the Storage page to check your account). You can learn more at ourFAQ.
To ease this transition, claim a free one-year subscription to Office 365 Personal.* This subscription includes 1 TB of OneDrive storage.
Alternatively, you can purchase additional storage,** or choose to remove some files.
We realize these are big changes to a service you rely on. We want to apologize for any frustration they may cause you. We made a difficult decision, but it’s one that will let us sustainably operate OneDrive into the future.
Thank you for using OneDrive.
– The OneDrive Team
Microsoft

If you’re not a OneDrive user, this might not affect you directly, but you should understand what is happening here.

What is Microsoft doing?

Well, in a nutshell, they’re taking storage space they previously provided to their users free of charge away.

Can they do this?

Of course they can. It’s not your storage space. You technically owned nothing when you signed up for your OneDrive account.

I’m safe because I’m not using OneDrive, I’m using (Enter any other free storage cloud service) right?

The important thing to understand with all of these free cloud based storage services is that you don’t own anything (except your content) related to the service. You do not own the quota or storage space allocated you. You are simply allowed to use it based on the current terms written by the provider. All of these services will leave open the option to change the amount of free storage they give you.

I should just accept this and move on then?

Yes and no. When I first got this message I was really mad at Microsoft. I’ve had a Onedrive (formerly Skydrive) account for a really long time. I haven’t had the need to buy any storage space for my account because of these extras they were giving me. I have paid for storage for my other Onedrive account that my wife and I share for our family photos etc. My own personal account was sufficient at the free level.

Now, I’m not sure what I’m going to do. I understand what they’re doing, to a degree, but I still believe what Microsoft is doing is really nasty. It feels much like a bait and switch scheme. Why? Well, if you are offered for free, a considerably larger amount of storage space over all the other services, you’re going to have a higher likelihood of switching to this service. Then, once you’ve committed, they take away most of what brought you over. You’re stuck with either paying up, or finding a different service.

I get any of these services could do this. I’m not a lawyer and I doubt they did anything illegal, they’ve got a lot more people working on this stuff to know better. It just seems really shady to take the storage away after you’ve been using it long enough to get yourself stuck in a corner. What are your thoughts? Do you agree? Disagree? Why?

I say this, COME ON MICROSOFT!!! You were really starting to grow on people again, all to go and do this. Shame on you! You’re taking 3 steps back again.

Dynamic PowerShell Profile


If you’re writing PowerShell scripts the right way, you’re testing your scripts against a Test, or DEV environment prior to deploying those scripts to your Production environment (You ARE testing your scripts right?). If you’re using source control for your scripts (You ARE using source control for your scripts right?) then you’re likely using a DEV branch for your in progress script and then when all is ready you can Merge that into MAIN or whatever you call your production branch.

NOTE: If you aren’t using source control, branching & merging, and testing, you’ve probably got bigger problems than your PowerShell profile.

Scenario

If you are able to remotely run your code against your servers or if you’re like me and you’re managing Office 365, you’re running your test scripts and your production scripts on the same workstation.

Some of the common repeatable steps I have to take to differentiate my DEV and PROD instance are to change my directory I’m running my scripts from and since I write a lot of Modules, I need to ensure I’m using the correct Modules.

Out of the box, you’re going to have to manually change your directory and go in and add a temporary module directory depending on where your DEV and PROD modules are stored. I can write a script to do this and that’s what I’ve done, but instead of calling that script manually, why not incorporate it into your profile?

Solution

Below is a simple profile I’ve created for my workstation that allows me to determine what environment I’m working in when I run PowerShell. Now, I do nothing different when I open my Windows PowerShell. When it executes it runs the $profile and my script executes prompting me to enter “DEV” or “PROD” based on what I’m working on at the time.

Here’s the script you will copy and paste into your $profile file on your workstation. See below for the instructions.

param(
	[Parameter(Mandatory=$True,HelpMessage="Enter the environment you will be working on (DEV or PROD)")]
	[String]$inpType
)

function Prompt
{
 	switch($inpType)
	{
		"DEV"
		{
			$color = "Yellow"
		}
		"PROD"
		{
			$color = "Green"
		}
		Default
		{
			Write-Host "ERR -- Environment Type entry not valid." `n -foregroundcolor Red
		}
	}
	Write-Host ($inpType + ">") -noNewLine -foregroundColor $color
	Return " "
}
if($inpType -eq "DEV")
{
	$env:PSModulePath = $env:PSModulePath + ";<ENTER YOUR DEV MODULE PATH>"
	Set-Location "<ENTER YOUR DEV SCRIPT DIRECTORY>"
	prompt
}
Else
{
	$env:PSModulePath = $env:PSModulePath + ";<ENTER YOUR PROD MODULE PATH>"
	Set-Location "<ENTER YOUR PROD SCRIPT DIRECTORY>"
	prompt
}
clear

What is this script doing?

There are three specific tasks this script is doing.

  • Add Temporary Module Path (based on Parameter entry)
  • Sets Current Directory (based on Parameter entry)
  • Changes Prompt text and color (based on Parameter entry

Instructions

Follow these steps to include the script above into your Windows PowerShell Profile. Note there are pieces you need to modify in the script above that are wrapped in <>’s. You’ll need to change the paths to represent your own locations.

  1. Open Windows PowerShell
  2. Verify you have a $profile created. Click for instructions and information about PowerShell Profiles
  3. Edit your profile by entering the following command: notepad $profile
  4. Copy the code above (make sure you’ve changed paths to represent your paths) and paste the code into the $profile notepad file
  5. Save
  6. Close PowerShell and Re-Open
  7. You should see a prompt similar to the image below

Profile Prompt

Once you’ve entered the environment, your PowerShell prompt should look like the below image

Profile DEV Prompt

Verify Your Profile Environment

It’s wise to verify you got the profile paths correct. Test that the $profile applied the variables as expected by running the following commands

Module Path

$env:PSModulePath

The information returned will be a semi-colon separated result including all current module paths. Your newly added path should be included in this

Current Directory

Get-Location

This should return the current directory your PowerShell session is set to right now. This should reflect your environment path you entered.

Prompt

You should be able to see the prompt is different depending on the input you chose.

PROD = PROD>

DEV = DEV>

If I Entered “DEV” Do I Have to Close PowerShell to get into “PROD”

No, you do not have to close out, though it might not be a bad idea depending on all the stuff you add to the profile. You can switch easily by entering the following command

. $profile PROD

There is a little bit of error handling, but not much in this script so be aware that you will want to augment this script if you want more error handling.

What can I do with this?

The sky is the limit. If you want to have specific modules loaded or snap-ins you know you’ll use, go ahead and add them. Just be warned, if you add too much stuff, it could slow the overall load time down as well.

Check back to my blog, I’ll show you how you can create a desktop shortcut to automatically enter the parameter so you can quickly get into your DEV or PROD PowerShell profile without entering anything.

You Know You’re A Nerd When…


You know you’re a huge nerd when… You send jokes to your co-workers complaining about leadership via Lync using fake PowerShell commands.

Wow! It’s getting really nerdy up in here today. 🙂

Joke of the day today.

Set-SPExpert -Identity “Leadership” -Force -ErrorAction SilentlyContinue

Wow! That’s so bad.

Weight Loss Challenge – Day 190 | Big Challenge Upcoming


Sunday I head for the Microsoft Ignite conference, but that doesn’t mean my weight loss challenge stays home right?

I’m a little anxious about this one. I’m a food guy and I love Chicago food. Chicago style pizza, hot dogs, Italian, etc. It’s an opportunity to likely eat on someone else’s dime for 6 days straight. Not to mention all the free drinks and whatnot too. How does one, such as myself, stategize against this?

I have no idea actually. I’m planning on bringing my workout gear as the hotel we’re in has a pretty nice gym. Hopefully I’ll be able to get some workouts in either before leaving in the morning or late when I get back (morning is the better bet, but just barely). Food wise, I don’t have a lot of solid ideas. Yes, I plan to give myself a liberal daily calorie goal. I’m not there to lose weight, so 1,800 calories a day is just not going to suffice. I’m thinking 2,500. I may gain, but not so much that I’ll have felt like a complete failure. My other strategy is to do as light a lunch as possible. That means fruits mostly with perhaps an egg or meat option. Something with some protein. My other option is to load my hotel room up with an obscene amount of beef jerky so my mornings consist of fruit and jerky which will keep me going strong when the feasts begin at lunch and dinner.

Unfortunately, there is a large part of me, not so deep down inside, that wants to just say screw it and live large. Eat what I want, as much as I want and just deal with it when I get home. I thought that until I found out just how many calories there are in one slice of Chicago style deep dish pizza. It’s obscene.

What are your recommendations for me?

Microsoft Ignite Activity Overload


I am so excited. On Sunday I get to hop on a plane headed for Chicago for the Microsoft Ignite conference May 4th-8th. Of all the nerd inspired things one could do, going to a Microsoft technology conference has got to be at the top of the list.

I’m learning pretty quickly, though that nerds apparently know how to party, or at least to appear to know how to party. I’ve not been to a conference of this size, so having to pick and choose my after-hours entertainment from the slew of options available to me is a bit daunting, but a nice problem to have.

I, and my employer are hoping I’ll come away from this 5 day experience with some valuable knowledge, skills, and contacts regarding SharePoint, Office 365, OneDrive for Business, Skype for Business, Windows PowerShell and so many other technologies.

I’m not sure if I have any readers that are also going to Ignite, but if you are, what sessions are you looking forward too and what after-hours stuff are you hoping to do? I’m really hoping I’ll bump elbows with someone important who has extra tickets to one of the Wild vs. Blackhawks playoff games as I’d love to see my team when I’m in Chicago.

For those of you not a member of the nerd world of enterprise technologies, what are your recommendations for things to do in the great Windy City of Chicago USA next week? Any great restaurants you can recommend? We’re going to be downtown in the Michigan ave area so I’m looking for great ideas there?

If any of you are going, I’d say we should meet up and have a drink, but let’s be honest, are we really going to do that? Do you really want to meet me? Of all the people out there, I’ll be honest, it’s not going to be that awesome meeting me… ha ha or is it? If you’re willing to go to a midnight viewing of the new Avengers: Age of Ultron (2015) movie with me, then I’ll meet up with pretty much anybody, or you have tickets to the Hawks game, just don’t plan on murdering me please, that would be a pretty big downer.

Error Opening SharePoint 2013 Site in SharePoint Designer 2013


I recently ran into a user who was getting the following error message every time they attempted to open their SharePoint 2013 site via the web interface in SharePoint Designer.

This action couldn’t be performed because Office doesn’t recognize the command it was given.

The pop-up message will look like the image below.

Untitled picture

The user had both SharePoint Designer 2010 and SharePoint Designer 2013 installed on their PC, which should not be an issue specifially as you can have both on the same computer without issues. You may find when you upgrade a particular SharePoint 2010 farm that your users will need to clear their SharePoint Designer cache in order for the new 2013 designer to work. The cache was not the issue here though.

Resolution

We found that the simple solution to the error was to re-install SharePoint Designer 2013 on the users workstation.

That simple action fixed the issue. The user had tried a repair of Designer which did no help, so a full uninstall then install was needed.

Hopefully this helps you if you run into this issue.

Who’s Managing Permissions?


Find_AccessRequestIt has been a while since I’ve posted anything, but that doesn’t mean I’ve been sitting around twiddling my thumbs all day. Here’s a quick SharePoint post. Stay tuned for more as we ramp up our new environment and we migrate to it. There should be some interesting stuff. (I hope)

Recently we’ve been getting requests from our messaging team (MS Exchange 2010) to remove/change e-mail addresses assigned in the Access Request field of our SharePoint sites as the domain has changed. This wouldn’t be an issue but we have 600+ Site Collections with 6,000+ individual sites. This of course means manually searching for the particular sites that have the offending e-mail address would be impossible. Thus, I have created a simple to use PowerShell script to iterate through every single SPWeb in the desired Web Application and return all Webs that have the user submitted e-mail address. Below is the full code.

**Note: I did not handle errors in this script. The most common error you will get is if you have Site Collections set to Read Only, or No Access. You will need to either reset their lock state or write logic to identify this and handle.

Step 1

  • Copy below code and save to file named Find_AccessRequest.ps1

clear
#End user is required to input Web Applciation, E-mail Address, and Export File Path
#Region User variable input
$inpWebApp = Read-Host "Enter the Web App Friendly Name"
$webapp = Get-SPWebApplication $inpWebApp
$inpEmail = Read-Host "Enter the e-mail address to search for"
$inpExportPath = Read-Host "Enter the path for the export"
#endRegion

#Gets the current date and time for the FilePath
$date = Get-Date -UFormat %y%m%d.%H.%M.%S
$path = $inpExportPath + "/" + $date + "_AccessRequest_" + $inpEmail + ".csv"

#Iterates through each site collection within the specified Web Application
foreach($spsite in $webapp.Sites)
{
	#Writes the current Site Collection to the console for troubleshooting purposes
	Write-Host "SC: " $spsite.URL

	#Iterates through each web within the site collection
	foreach($web in $spsite.AllWebs)
	{
		#Web must have permissions broken, request access enabled, and the e-mail must match the user input
		if( $web.HasUniqueRoleAssignments -and $web.RequestAccessEnabled -and $web.RequestAccessEmail -eq $inpEmail) 
		{
			#Writes the results to the console and exports to a CSV file
			Write-Host "	" -NoNewline; Write-Host $web.URL -BackgroundColor White -ForegroundColor Black
			Write-Output $web.URL | Out-File -Append -FilePath $path
		}
	}
}

Step 2

  • Run the file created in Step 1
  • Enter the following information (see screenshot below)
    • Web Application Name
    • E-mail Address to find
    • Path for export (do not include filename, the script will create the name)

Find_AccessRequest_Input

Step 3

  • As the script runs it will provide the following information on the console screen in real time (see below)
    • Site Collection URL
    • SP Web URL that has a matching e-mail address in the Access Request field (highlighted in White)

Find_AccessRequest-ResultsConsole

  • Now navigate to the Export location you entered. You should see a file with the following name:

yymmdd.hh.mm.ss_AccessRequest_<email address>.csv

  • Open the file. There will be a single column of data. The data will be each SPWeb that has the supplied e-mail address configured as the Access Request e-mail. It will only include Webs that have their permissions broken, which enables the web manager to configure the Access Request field independent of the parent site/web.

I hope this helps someone out there who needs to find an e-mail address in the Access Request field. I may at some point add to the script to allow for changing the address in bulk, but so far our need has only resulted in a few webs at a time.

As always, please a comment letting me know if this helped or if you have ideas to improve upon the script or for ideas for future scripts.

Thanks.

ISSUE: KB2844286 Security Update on SharePoint 2010


Came in today to find the following error message showing up on seemingly random web parts and lists throughout our SharePoint 2010 Foundation farm. ULS Logs on the servers weren’t very helpful.

[This issue has been RESOLVED see updates below]

KB2844286 Error

For the sake of search indexing, here is the text version of the error we are getting.

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.

We quickly tracked it down to a Security Update that was applied to our web front end servers last night. Check the OS below to find the KB update associated with your server.

Windows XP and Windows Server 2003

Windows 7 Service Pack 1 and Windows Server 2008 R2 Service Pack 1

Windows Vista Service Pack 2 and Windows Server 2008 Service Pack 2

This is in regard to the following Microsoft Security Bulletin for July 2013

Microsoft Security Bulletin MS13-052

As a temporary workaround, we found uninstalling the update (KB2844286) from your servers (all WFE’s and App servers) then performing an IISReset on the servers will resolve the issue. Several others have experienced this issue as noted in just one of many forums such as the one below

http://social.technet.microsoft.com/Forums/sharepoint/en-US/cc9a557b-93cd-40d5-965c-e0a2f107624d/unable-to-display-this-web-part-error-message-after-patch-kb2844286

If I find there is a solution better than uninstalling I will update this post to reflect that. As of right now, uninstalling this update is the best option.

[Update 7/16/2013 3:40pm]

It appears the error typically appears when a list or web part view has had the XSLT customized. At least in our Farm, that has been the common behavior.

[Update 7/17/2013 10:03am]

Not much of an update, but I’m awaiting contact from our Microsoft TAM to see about this issue. If we don’t hear from them soon, then we’ll be opening a ticket with Microsoft. Luckily we were able to work around the issue by uninstalling.

[Update 7/17/2013 12:50pm]

I just received confirmation from our TAM that Microsoft is aware of 2 issues regarding the patch noted in this article above. One of which appears to be the SharePoint issue we’re having.

[Update 7/17/2013 2:43pm]

Just spoke with our Microsoft Sr. Support Escalation Engineer assigned to our premier support ticket and here is their response (summarized).

“Our product group is currently working on the updated patch. We have no ETA for the new release at the moment.”

Looks like we wait then for a resolution.

[Update 7/17/2013 2:59pm]

One more confirmation from Microsoft Support and a link to the forum MS is using to track the issue publicly. No public information just yet beyond that, however.

“Both the SharePoint and .NET product groups are aware of the issue and they are in the process of fixing the patch.”

Follow the issue at this TechNet Forum

[Update 7/18/2013 9:24am]

So far I have heard of no updated patch being released yet by Microsoft. There were two MS Security Bulletin updates but it doesn’t appear they were related to this issue as they were for Bulletin MS12-006 and MS12-052.

[Update 7/21/2013 12:36pm]

Still no updated patch. Received an e-mail from our MS Support representative and they indicated they too have no ETA on any updates to the security patch. I guess I’d rather they take their time then rush an update out all to break something else. It would be a good idea if Microsoft were to either add a note to the update download page indicating the issue, or just pull the update altogether.

[Update 7/24/2013 8:28am]

I just got a message from our Microsoft Support representative and she informed me there is no update as of yet on a new download for the patch. No surprise there.

[Update 7/25/2013 7:50am]

As you can see from the comments that have arrived thus far, it appears Microsoft has provided a fix to the KB2844286 issue. We are in the process of testing it out in our DEV environment now. Let’s hope it fixes it and doesn’t cause more issues.

[Update 7/25/2013 8:22am]

I am at this point, comfortable with counting this issue RESOLVED. We’ve tested it in DEV and the solution resolves the problem and doesn’t seem to break anything else. We won’t be able to complete the resolution in our Production environment until after hours as we will have to re-install KB2844286 which will require a reboot and the patch requires at the very least an IISRESET.

Go to http://support.microsoft.com/kb/2872441 to download the update. Note: You will need to run an IISRESET for the update to take effect after installing.