Recently I was tasked with the job of migrating a small WSUS server from a Windows Server 2008 R2 environment, to a 2012 R2 server without the role installed yet. Naturally, I’d like to automate the process as much as possible by using Powershell to export the current environment, and move it into a new server. This can be accomplished fairly simply with the following commands. Let’s take a look at how we can do this.
Prerequisites
-
set-executionpolicy unrestricted
- ps-remoting enabled on source server and destination server
If you have issues connecting, make sure you have the trustedhosts option for WSMan set correct:
cd WSMan:\localhost\Client Set-Item .\TrustedHosts -Value "*" -Force cd WSMan:\localhost\Client Set-Item .\TrustedHosts -Value "*" -Force
Connect to your new 2012 R2 destination server:
enter-pssession DESTINATIONSERVER -credential DOMAIN\User
Install the WSUS role and server migration role
install-windowsfeature -name updateservices -IncludeManagementTool Install-WindowsFeature Migration
At this point, the destination server will open a configuration wizard for WSUS. Close that, and move to your source server.
Connect to your source server and run the windows server migration PSSnapin to migrate the local users and security groups to a file we can import on the new one.
enter-pssession SOURCESERVER -credential DOMAIN\User Add-PSSnapin Microsoft.Windows.ServerManager.Migration Export-SmigServerSetting -User All -Group -Path c:\tmp -Verbose
Import Users
Migrate Databases
Modify Group Policy settings to redirect users.