Migrating Windows Server 2003 to 2012

This is an overview of my effort to upgrade some of our old 2003 servers to Windows Server 2012. It is quite possible there are better ways to accomplish this, as I’m just a developer and server upgrade is not something I do… well it was the first time I did it.

Migrating IIS 6.0 to 8.5

First, I needed to migrate IIS applications, app pools and app pools account. In order to automate this as much as possible, I installed Microsoft Web Platform installer on 2003 and Web Deploy 3.5 (The Web Deployment Tool). I used this guide http://www.iis.net/learn/publish/using-web-deploy/synchronize-iis-60-web-sites to help me.

Create backup on IIS6: iisback /backup /b PreWebDeploy

View dependencies on IIS 6: msdeploy -verb:getDependencies -source:metakey=lm/w3svc/1

Create package on IIS 6:

“C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe” -verb:sync  -source:metakey=lm/w3svc/1 -dest:package=C:\YourExportedPackage.zip,encryptPassword=YourPassword  -enableLink:AppPoolExtension

The password is required since we are exporting App Pools and the identities they use (by specifying enableLink:AppPoolExtension).

Run whatif analysis on IIS 2012:

“C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe” -verb:sync -source:package=c:\YourPackage.zip,encryptPassword=YourPassword -dest:metakey=lm/w3svc/1 -whatif > msdeploysync.log  -enableLink:AppPoolExtension

This will run what-if analysis without actually migrating anything. Check the log and install needed dependencies. Once all dependencies are installed, run the actual migration:

“C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe” -verb:sync -source:package=C:\YourPackage.zip,encryptPassword=YourPassword -dest:metakey=lm/w3svc/1 -enableLink:AppPoolExtension

 Another way (this does not copy the content, so you have to copy the folders with sites contents):
[appcmd seems to be available only starting with IIS7. Thanks to Nick for the correction.]
Run On Source:

C:\Windows\System32\inetsrv\appcmd list apppool /config /xml > C:\ apppools.xml

C:\Windows\System32\inetsrv\appcmd list site /config /xml > C: \sites.xml

Run On Destination:

C:\Windows\System32\inetsrv\appcmd add apppool /in < C:\apppools.xml

C:\Windows\System32\inetsrv\appcmd add site /in < C: \sites.xml

Migrating Shares and related permissions

First, create all of the folders for the shares. Then export the whole folder from the registry: Created registry export for the whole folder from 2003: HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ LanmanServer \ Shares

Restore it on the destination server. This almost takes care of all the shares, except for NTFS permissions.

To copy NTFS permissions run on source:

Icacls C:\YourFolderThatNeedsNtfsPermissionesCopied  /save ExportedFileWithPermissions.txt /t

Run on destination:

Icacls C:\ /restore ExportedFileWithPermissions.txt

 

Migrate Users and Groups

First, install Windows Server Migration. Then use SmigDeploy to migrate users and groups.

Run on Destination (some parameters may be different for other configurations. Google SmigDeploy):

SmigDeploy.exe /package /architecture X86 /os WS03 /path C:\userMigrationTool

Go to Source server and run from userMigrationTool folder (created in a previous step). This will register SmigDeploy on source.

.\Smigdeploy.exe

Run on source:

Export-SmigServerSetting -User All -Group -Path C:\YourMIgrationFolder -Verbose

It’ll ask you a password. Pick one.

Run on destination:

Import-SmigServerSetting -Group -Path C:\YourMigrationFolder -Verbose

 

COM

Since I needed to migrate some COM’s, I had to add a feature COM+ Network Access to enable COM.

Tasks

Open Task Scheduler on destination.

Go to Action – Connect to another Computer. Connect to your source server.

Export the tasks to a temporary location as xml files. I didn’t see a way to export them all at once, so I did it one by one.

Open Task Scheduler on your destination again. Import the tasks.

It may pop up a message saying the account that you used to set up the task needs “Log on as batch job” privileges. In that case, follow a few more steps:

Run secpol.msc /s

Select “Local Policies” in MSC snap in

 Select “User Rights Assignment”

 Right click on “Log on as batch job” and select Properties

Click “Add User or Group”, and include the relevant user.

13 responses on “Migrating Windows Server 2003 to 2012

  1. JeffromTAirport

    I’m trying to run iisback /backup /b PreWebdeploy on 2012 target using this path in the system environment below and getting ‘iisback’ is not recognized as an internal or external command, operable program or batch file. Running as Administrator from the C prompt, within Deploy folder, and Root (Windows). Any assistance is helpful. Thanks.

    C:Program Files (x86)PHPv5.4;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program Files (x86)Microsoft ASP.NETASP.NET Web Pagesv1.0
    .

  2. Jeffrey Lawrence

    Thanks thanks thanks admin. This has been a treasure trove of help and tying all the back info together. Great stuff!!

  3. JeffromTAirport

    XXXXXXXXXXXXXXXXXXXXXXX What a process. After several runs of creating a package, and after changing the Tem/TMP files to use D: with more space, I’m now getting :Skipping source dirPath (D:SitesCTAPrototype) because of rule SkipIn
    validSource.
    Could not find directory ‘D:SitesCTAPrototype’.
    Warning: Skipping source dirPath (D:SitesCTAProtoype) because of rule SkipInv
    alidSource.
    Could not find directory ‘D:SitesCTAProtoype’.
    Total changes: 0 (0 added, 0 deleted, 0 updated, 0 parameters changed, 0 bytes c
    opied)
    xxxxxxxxxxxxxxxxxxx-Is it because Msdeploy deleted directories after several create packages and sync or do I need to change the Temp/TMP variables back to “C”? If I run the PreDeployBackup, will that be more detremental? Thanks.

  4. JeffromTAirport

    Trying to understand when each step/command is perform. I see the first set of instructions for PreWebDeploy was done on source. Is the package then physically moved to the target and then sync web deploy run? Is this a push or pull. Explaining the other options listed will help as well.

  5. admin Post author

    I used a manual option – created a package on the old server first, moved the package to the new server, synced it on the new server. If you want to use Pull or Push option, then you don’t need to create the zip packages – you run msdeploy with Push/Pull option directly from the server (push if running from source; pull if running from destination). I haven’t tried Push/Pull myself.

  6. Nick

    Thanks, it’s a great article.

    The only part that beats me is the “Another way (this does not copy the content…) which is exactly what I am interested in.

    How do you run on the Windows 2003 IIS6 source server this?

    C:WindowsSystem32inetsrvappcmd list apppool /config /xml > C: apppools.xml

    It looks like appcmd is part of IIS7 and above.

    Thanks,
    Nick

  7. admin Post author

    I think you are right, apppool is only available starting with IIS7. I used webdeploy and wrote about apppool just as an option. I’ll edit it. Sorry about it.

  8. Nick

    No problem… I was so happy first, I was looking for something exactly like the “Another way (this does not copy the content, so you have to copy the folders with sites contents)” for IIS 6.

    Anyway, still a great article, thanks for writing it.

  9. Froberg

    @Jeff, I realize it’s been years, but your comment got me curious. D:yourpath doesn’t seem like it would be a viable path in a windows environment. Usually you need liberal use of \ to indicate folders. I’d assume yours should be D:\Sites\CTAPrototype, yeah?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.