Wednesday, September 11, 2013

Specify an Alternate Source Path for Windows Server 2012 using PowerShell


As you may already know, unlike Windows Server 2008 R2, for Windows Server 2012, you have to specify an Alternate Source Path for the installation media in order to configure Server Roles and Server Features.  If you are directly using Server Manager to do this, you can specify the Alternate Source Path at that time.  However, if you are attempting to automate the installation of some software programs and applications, it is probably more convenient to simply do this using Windows PowerShell. 
This setting can also be controlled through Group Policy, but here I prefer to control it directly through manipulating the Registry Keys:
Clear-Host
$AlternateSourcePath = "D:\sources\sxs"

#Make sure you change the PowerShell execution policy prior to running this script (Set-ExecutionPolicy RemoteSigned)
#Create the Servicing Registry Key
New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Servicing -Force

#Create the LocalSourcePath String Value
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Servicing -Name "LocalSourcePath" -Value $AlternateSourcePath -Force



No comments:

Post a Comment