Learn › Windows Server

Migrate Windows Server Roles and Features to a New Server with PowerShell

Export roles and features from an old Windows server, compare with the new one and install what's missing with PowerShell, using a dry run and report.

Intermediate 8 min read
By Gopinath Karthikeyan · 29 Nov 2026

When you move a Windows server to new hardware, a new OS version or the cloud, the first question is always the same: what was actually installed on the old one? Roles and features are the foundation. If IIS, .NET 3.5 or the Failover Clustering tools are missing on the new server, everything you copy on top of it fails in confusing ways.

Rebuilding the list from memory or screenshots of Server Manager doesn’t work past a couple of servers. This post shows the approach I use: export → compare → install only what’s missing → report, all in plain PowerShell.

Examples use made-up server names (SRV01 = old server, SRV02 = new server) and a made-up share. Test on non-production servers first and follow your own change process.

What we want

  • A file listing every role, role service and feature installed on the old server
  • A comparison against the new server: what’s already there, what’s missing, and what doesn’t exist on the new OS at all
  • Install only the missing items – dry run first
  • A report you can attach to the change ticket

Step 1: export from the old server

Get-WindowsFeature returns roles, role services and features together. The FeatureType column tells them apart.

# Run on SRV01 (old server)
$share = '\\FS01\Migration'

Get-WindowsFeature |
    Where-Object Installed |
    Select-Object Name, DisplayName, FeatureType, Depth |
    Export-Csv "$share\$env:COMPUTERNAME-features.csv" -NoTypeInformation

Use the Name column (for example Web-Server, NET-Framework-45-Core) – display names change between Windows versions, internal names mostly don’t.

Step 2: compare on the new server

# Run on SRV02 (new server)
$share  = '\\FS01\Migration'
$source = Import-Csv "$share\SRV01-features.csv"

# Index the new server's features by name for quick lookups
$target = @{}
Get-WindowsFeature | ForEach-Object { $target[$_.Name] = $_ }

$result = foreach ($f in $source) {
    $t = $target[$f.Name]
    $status = if (-not $t)          { 'Not available on this OS' }
              elseif ($t.Installed) { 'Already installed' }
              else                  { 'Missing' }

    [pscustomobject]@{
        Name        = $f.Name
        DisplayName = $f.DisplayName
        Type        = $f.FeatureType
        Status      = $status
    }
}

$result | Sort-Object Status, Name | Format-Table -AutoSize

The three statuses are the whole point:

  • Already installed – nothing to do
  • Missing – install it in the next step
  • Not available on this OS – needs a decision, not a script (see below)

Step 3: install only what’s missing (dry run first)

$missing = ($result | Where-Object Status -eq 'Missing').Name

# Dry run – shows what would happen, changes nothing
Install-WindowsFeature -Name $missing -WhatIf

# Real run
$install = Install-WindowsFeature -Name $missing
$install | Select-Object Success, RestartNeeded, ExitCode

Two things that catch people out:

  • .NET Framework 3.5 (NET-Framework-Core) often fails on servers without internet or Windows Update access. Point it at the OS media: Install-WindowsFeature NET-Framework-Core -Source D:\sources\sxs.
  • Restarts. If RestartNeeded is Yes, restart and run the compare again. Some features only report as installed after the reboot.

Step 4: save a report

$result | Export-Csv "$share\SRV02-feature-compare.csv" -NoTypeInformation

$result | ConvertTo-Html -Title 'Feature comparison SRV01 -> SRV02' `
    -Property Name, DisplayName, Type, Status |
    Out-File "$share\SRV02-feature-compare.html"

Run the compare once more after the install. A clean report (no Missing rows) is good evidence for the change ticket.

“Not available on this OS” – removed features

Moving to a newer Windows Server version means some features simply no longer exist. On Windows Server 2025, Microsoft’s removed features list includes, for example:

  • Windows PowerShell 2.0 Engine – scripts or tasks that force powershell.exe -Version 2 must be updated to run on PowerShell 5.1 or 7
  • SMTP Server – there’s no built-in replacement, so apps that relay mail through the local SMTP service need another mail relay
  • IIS 6 Management Console – only matters if old admin tools depend on it

Don’t try to script around these. List them in the report and agree the replacement with the application owner.

Installing the role is not migrating the role

This is the part most checklists skip. Install-WindowsFeature gives you an empty role. The settings live elsewhere and need their own export:

Role What still needs moving
Web Server (IIS) Sites, app pools, bindings, certificates, plus extras like URL Rewrite
File Server Shares and their permissions (Get-SmbShare, Get-SmbShareAccess, NTFS ACLs)
DNS Server Zones and records (Export-DnsServerZone), forwarders
DHCP Server Scopes, reservations, options (Export-DhcpServer)
Print Server Printers, ports and drivers (printbrm.exe)
Network Policy Server Export-NpsConfiguration
AD DS / AD CS Never copy – promote a new domain controller, plan a proper CA migration

I treat each of these as its own step after the feature sync – IIS especially deserves a post of its own.

Running it for many servers

Once the three steps work by hand, wrap them so they run from a pipeline (Jenkins, GitHub Actions or Ansible – whatever your team uses):

  • Parameters: source server, target server, share path
  • Mode: Compare by default, Install only when explicitly chosen
  • Output: one report per server pair, kept with the build

The same rule as always: report first, change second.

FAQ

How do I export installed roles and features in Windows Server? Get-WindowsFeature | Where-Object Installed | Export-Csv features.csv -NoTypeInformation – then use the Name column to reinstall them elsewhere.

Can I install Windows features from a CSV file? Yes. Import the CSV and pass the names to Install-WindowsFeature -Name. Compare first so you only install what’s missing and spot names that don’t exist on the new OS.

Does Install-WindowsFeature copy the role’s settings? No. It only installs the role. Settings such as IIS sites, DHCP scopes or file shares have to be exported and imported separately.

Wrap-up

Export, compare, install what’s missing, report – four small steps that turn “I think the old server had IIS and .NET 3.5” into a checked, documented list. Coming next: migrating IIS sites and app pools the same way.

If you’re working on a similar migration, I’d like to hear how you handle it – connect with me on LinkedIn.

Practise this topic

Test yourself with free questions on this topic – instant answers and explanations.

Start practice questions

PowerShellWindows ServerMigrationServer RolesAutomationSRESysAdmin

Gopinath Karthikeyan

Gopinath Karthikeyan – Windows Site Reliability Engineer with about 12 years in enterprise Windows Server infrastructure, and founder of WinOps Academy. YouTube · LinkedIn

More in Windows Server