Browsed by
Category: Windows Server

Creating a Sysprepped Windows Server 2012 image

Creating a Sysprepped Windows Server 2012 image

One of the advantages to running Windows Server 2012 is the highly improved Hyper-V engine. In my time working on deployment scenarios I have found that creating a reliable baseline VM is critical to my success in getting farms deployed quickly and easily. To this end I have found that getting a new VM server with the OS installed to the correct level with patches, the SharePoint prerequisites, and all of the customizations that I like to have on a server already installed and ready to go in minutes is pretty important.

This is where Sysprep comes the picture. We have been using Sysprep to prepare images since Windows XP as it allows us to generalize the critical system GUIDs and when the image is launched post-Sysprepping it will create new GUIDs and allow you to re-register the system. While this has always been a recommended practice for deploying the same VM over and over, it has not been a required function until Windows Server 2012.

There are some drawbacks to generalizing a system that you are trying to deploy. For example, once a server has been registered in a SharePoint farm that server cannot be expected to interoperate properly once generalized. Translation: you can’t join a SharePoint server to a farm, then do a generalized Sysprep, and expect the new server to be a member of the farm. It is going to have an understandable identity crisis.

For this reason, you will want to do your generalized Sysprep after installing SharePoint & it’s patches, but BEFORE doing your PSCONFIG. This will allow you to redeploy the image, set the computer name, a domain and then run PSCONFIG to join the server to the farm. On average this process will take about 15 or so minutes.

Here is how you actually will perform a generalized Sysprep:

1.) Get your image where you are happy with it

Patch your OS. Install the softwares that you want to be able to have already ready to go. I recommend checking out some of my other posts for helpful PowerShell scripts that you will want to run to help you with some of the base OS configurations that you will find useful. “Setup your development machine right” & “Track what you are doing in PowerShell” are two good examples of this.

2.) Take a snapshot of your VM

This will allow you to return to the operational state you are currently in when you finish Sysprepping the image.

3.) From command line run: “c:\windows\system32\sysprep\sysprep.exe”

clip_image001

4.) Choose the option to “Generalize the system”

This is going to remove the GUIDs from the registry and allow you to create new ones upon boot. This will also remove the license key information and require that you re-register with Microsoft when you use the image. This will allow sharing of an image with others without the fear of the licensing police coming after you.

5.) Choose the option to shut down the machine when complete

6.) Click Ok

7.) Once the VM is shutdown make a copy of the VM

It is a good idea to store this in a location that you going to remember what the VM is. It is also a good idea to rename the VM folder & files so that you know that this is a generic image. You will want to give the files a new name each time you redeploy them.

8.) Revert to your pre-Sysprepped snapshot

As previously stated, this will return you to where you were before you started this exercise with an image ready to deploy on.

I hope that this is as useful for you as it has been for me.

How to: Activate Desktop Experience in Windows Server 2012

How to: Activate Desktop Experience in Windows Server 2012

I ran into an issue where I needed to active that Desktop Experience in on Windows Server 2012 and found that it was not in the same place that I was expecting it to be from previous versions. Figured that this might help some people.

Desktop Experience is required to be running if you are going to utilize OneNote, which when working in a demo server environment can be very useful. There are some DLLs that are not accessible unless you are running the Desktop Experience that are critical to applications like Snagit & Camtasia.

Wizard Driven:

To active the Desktop Experience go Server Manager | Local Server | Manage | Add Roles & Features

1

Once in the wizard under Features drill into the User Interfaces and Infrastructure and select Desktop Experience. This will active the Ink and Handwriting Services & Media Foundation features as well.

2

After installation the server requires a reboot to complete and will make the features active for accessing.

PowerShell:

From a PowerShell prompt running as Administrator use the following command:

3

During execution you will see the following:

4

Once complete you will be notified that you need to reboot the server:

5

Enjoy!

 notepad active Desktop Experince script

How to: Run PowerShell ISE as Administrator under alternate credentials

How to: Run PowerShell ISE as Administrator under alternate credentials

Coming from a security focused AD background I prefer to have the Managed Service Accounts OU locked down with a GPO restricting interactive logon to a server. This helps avoid service accounts becoming compromised and being taken advantage of in attacks.

Having an ISE is especially helpful when you are doing SharePoint work on the farm and while I am a big fan of PowerShell, running straight at the command line is often a pain. Rather than installing one of the terrific third party solutions out there for an Integrated Shell Environment I try to only install the PowerShell ISE.

As we know, there are something that you cannot do unless you are running in the context of the Farm Administrator account. There is code out there that will let you elevate your PowerShell script and run in the context of a different user, but I really wanted to be able to open PowerShell ISE as the farm account so that I can run parts of a script at a time, or rerun specific lines.

Here is the code that I compiled that allows me to launch PowerShell ISE as the Farm Admin account:

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0

# Farm account name
$farmAccountname =
“domainservice_account”

# Load the Farm Account Creds
$cred = Get-Credential
$farmAccountname

# Create a new process with UAC elevation S
tart-Process
$PsHomepowershell.exe -Credential $cred -ArgumentList “-Command Start-Process $PSHOMEpowershell_ise.exe -Verb Runas -Wait

Once your PowerShell ISE window is launched you can run the following code to validate that you are running as the user that you are expecting:

[Security.Principal.WindowsIdentity]::GetCurrent().Name

Great you learned some more neato PowerShell, but why do I need to use a PowerShell command for this?

You may be asking why wouldn’t I just do a simple “SHIFT+Right Click” and “Run as different user” rather than resorting to a PowerShell solution. The answer is that doing that does not give you the runAs Administrator privileges that we need to do so many of SharePoint’s PowerShell Functions.

Smarty Pants.

powershell PowerShell launch code

notepad Text launch code

powershell User Context validation code

How to disable Shutdown Event Tracker in Windows Server 2008 R2

How to disable Shutdown Event Tracker in Windows Server 2008 R2

Scenario: You have people in your office, you are in the middle of work in 2 different Dev VMs plus Visual Studio on your host or you are working on several servers plus your local Dev VM while writing admin scripts (making this viable for Admin and Dev types alike).  Time for a reboot of your Dev VM so you click on reboot and flip back to your other work and figure you will check back in 10 minutes once it has had time to reboot.  An hour goes by and you are finally rearing to go on the Dev VM so you flip back to it only to find this screen:

Shutdown1

Anyone else want to throw a virtual rock at the virtual screen at that point?

I am in the middle of building out 5 new VMs for my lab and always find having to enter a reason for rebooting to be painful, so I FINALLY decided to do something about it. 

There are a number of articles out there on how to do this, but many of them are out of date.  I tried every one of them and this was the one that I found that works every time:

How to enable and disable Shutdown Event Tracker

  1. Open gpedit.msc

  2. Go to Computer Configuration | Administrative Templates | System

  3. Set “Display Shutdown Event Tracker” to Disabled

shutdown2

A reboot is not required for this to take effect.  You set a Group Policy if you are in a domain or multi-machine situation, but for standalone systems, this works just fine.

CAVEAT: I highly recommend this only be used in development/test VMs.  This makes it so there is no safety net if someone accidentally clicks restart or shutdown instead of logoff. 

I am big on giving credit to those who I find information from, but in this case there were so many different options that I lost track of who I got this lead from, so thank you to the unnamed tipster for this lead.

SharePoint 2010 & SQL 2008 R2 build numbers and helpful patching links

SharePoint 2010 & SQL 2008 R2 build numbers and helpful patching links

In an effort to make life simpler I have compiled a short list of useful link to build numbers and patching sites for SharePoint 2010 and SQL 2008 R2.

The Microsoft SharePoint Updates PagesSharePoint 2010 – http://technet.microsoft.com/en-us/sharepoint/ff800847.aspx
SharePoint 2007- http://technet.microsoft.com/en-us/office/sharepointserver/bb735839.aspx
This is your official sites for downloading the SharePoint updates from Microsoft.  Highly useful rather than waiting on the blogger community to send you a link, or get the TechNet bulletin, your carrier pigeon to arrive, or any of the other 120+ ways to get your SharePoint update information!

Cornelius J. van Dyk’s Blog on Versions for SharePoint
http://www.cjvandyk.com/blog/Lists/Versions/
Highly useful link if you find yourself a CU or two behind and you want to know what version of the CU is currently applied to your farm.  Simply visit your Central Admin Manage Patch Status page http://localhost:####/_admin/PatchStatus.aspx to check what version number your farm is on.

SQL 2008 R2 build numbers
http://support.microsoft.com/kb/981356/
This has proven to be the most reliable site I have found for listing the latest build numbers for SQL Server since 2008 R2 dropped.  To find out what what build you are running do the following:

  1. Open SQL Management Studio
  2. New Query
  3. type and then execute the following command
    select @@version 

    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode, .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode pre
    {font-size:small;color:black;font-family:consolas, “courier new”, courier, monospace;background-color:#ffffff;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode pre
    {margin:0em;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode .rem
    {color:#008000;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode .kwrd
    {color:#0000ff;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode .str
    {color:#006080;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode .op
    {color:#0000c0;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode .preproc
    {color:#cc6633;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode .asp
    {background-color:#ffff00;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode .html
    {color:#800000;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode .attr
    {color:#ff0000;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode .alt
    {background-color:#f4f4f4;width:100%;margin:0em;}
    .externalclassaf644619e5194a77b8e785ba7f262756 .csharpcode .lnum
    {color:#606060;}

We are working on getting a SQL Server version’s page up on CvD’s blog as well, but for now I here is a table with the info:

April 2010 RTM
10.50.1600.1
May 2010 CU1
10.50.1702.0
June 2010 CU2
10.50.1720.0
August 2010 CU3
10.50.1734.0
October 2010 CU4
10.50.1746.0
December 2010 CU5
10.50.1753.0
How to: Configure Microsoft Nework Load Balancing (NLB) in a Virtualized Environment for Windows 2008 R2 on a Cisco Switched Network

How to: Configure Microsoft Nework Load Balancing (NLB) in a Virtualized Environment for Windows 2008 R2 on a Cisco Switched Network

Firstly, can I make this blog post’s title any longer?  Yes, I didn’t include that I am doing this for SharePoint 2010, so thanks for the smart-alecked thoughts subconscious!

Scenario:

Using VMware vSphere 4.0 server to host Windows 2008 R2 64bit Servers which host SharePoint 2010 Server and looking to use Microsoft’s NLB.

Set up NLB in mulitcast mode as recommended by everyone in the blogosphere and some different Microsoft articles and viola!  It works…  until 5 minutes after implementation and then anyone who sits outside of the site where the servers reside can no longer get to the pages.  Users at the site where the servers are can consistently resolve pages without fail.  Anyone offsite gets an error.

How do you get NLB to work every time for all users regardless of location?

Resolution:

All trouble shooting pointed back to networking.  After a bit of digging and working with the site networking team, I found that we had Cisco 4506 switches that we were going through and while they support multicast, the switch needs a static MAC address entered in it’s ARP table or it will not allow anyone coming to the switch from outside to connect because it doesn’t know who to route the packets to.  The users on the same switch are able to see the advertisement of the MAC through broadcast.

Setting the static MAC entry in the ARP table worked for some users for a little while, but not for everyone.  It wasn’t until we came across an article from VMware that we discovered that the switch supported IGMP Multicast and not standard multicast.

Things started working for a while and then we hit the wall again.  I started a clean NLB Cluster installation and found that switching from standard Multicast to IGMP Multicast changed the MAC address of the virtual NIC!  We were using the standard Multicast MAC for the ARP table entry instead of the IGMP Multicast MAC address.

 
 
Once we made the change to the ARP table with the correct static MAC address, we were off to the races for all users.

Helpful Links:

Here are a few helpful links to read when you are considering setting up NLB:

Implementing Microsoft NLB in a Virtualized Environment
http://www.vmware.com/files/pdf/implmenting_ms_network_load_balancing.pdf

Configure Network Load Balancing Cluster Operation Mode
http://technet.microsoft.com/en-us/library/cc731616.aspx

Internet Group Management Protocol
http://technet.microsoft.com/en-us/library/dd458978(WS.10).aspx

Verifying the NLB Cluster and Enabling Client Access
http://technet.microsoft.com/en-us/library/cc731050(WS.10).aspx

Install and configure NLB on each cluster host in the new cluster
http://technet.microsoft.com/en-us/library/cc772392(WS.10).aspx

Unable to access VMware Workstation Guest after Host Machine crash

Unable to access VMware Workstation Guest after Host Machine crash

Scenario:

While doing SharePoint 2010 development is now able to be done from within a Windows 7 64bit system and even inside of a Hyper-V VM, many of us in the wide world of computing are still using VMware Workstation, Fusion, Player, or even the old VMware GSX Server to run local development environments.  This post deals with how to get back into a VM that seems horribly locked after your workstation hosting your VM crashes hard.

Symptom:

System crashed while a VMware Workstation Guest was running. The VM now reports that it is in use by the current host. Taking ownership of the VM is not possible.  All hope is starting to fade…

Solution:

Go to the VM location and delete the .lck files and folders. This will unlock the VM Guest and allow you to boot in.  VMware treats this like a hard server reset, and offers safe mode booting at that point. If the system is able to recover cleanly, it gets you back to operational.

Caveat:

Just like anytime you hard reset a server you must be prepared to deal with the consequences.  Data loss, data corruption, and complete system failure is possible as a result of such action.

However if you are left with the alternative of complete system rebuild already, it might be worth a shot.  Just don’t blame me if your system is toasty afterwards.

Random Server hang issues result in a required hard reset

Random Server hang issues result in a required hard reset

Symptom:

Windows 2008 R2 64bit systems hang at random and require a hard reboot of the system to recover. You can remote to the system via KVM (RDP is not accessible) and even do a CTRL+ALT+DEL, but after the lock screen goes away and tries to give you a login screen… YOU GET NOTHING. Only silence…

Root Cause:

We ended up with a three headed root cause on this set of issues.

1.) Our blades had a bad BIOS version that caused the system to get into an inconsistent state and required a power cycle to get them clear.

2.) The hardware vendor had Data Execution Protection (DEP) turned on at the hardware layer by default.

3.) By default Microsoft has its own version of DEP turned on for all services unless you add in exceptions.

How did we diagnose this beast? Many team members (Dan, Don, Christian, Jim, and Cornè) all weighed in and found part of this along with support from our hardware vendor and Microsoft.

The issues plagued us for several weeks because it was not a predictable failure and there was NOTHING in the logs to correlate the issues together other than a single model of blade server.

Call with Microsoft and the hardware vendor suggested that the Microsoft DEP might be part of the issue as well. Luckily our support level was good enough to get both vendors on the same line and have them work together. Support calls like this are not cheap if you don’t have the agreements in place already.

Resolution

1.) Flash the BIOS with an updated and vendor verified version.
2.) Turning off of the hardware DEP
3.) Setting the Windows DEP to on “for essential Windows programs and services only”

Since making these changes we have not seen reoccurrence of the random system hang issues. I will update this post if things change… but so far, so good!