Applies to: Windows Server 2019, Windows Server 2022, and Windows Server 2025.
A repeatable inventory captures operating system, hardware, installed roles, uptime, and network data for auditing and migration planning.
Prerequisites
- PowerShell remoting is enabled to the approved target list.
- The operator can query CIM and installed-feature data.
- The export directory is access-controlled because inventory can contain sensitive infrastructure details.
Step-by-step procedure
- Create a reviewed list of server FQDNs.
- Run the inventory script from a management host.
- Inspect connection errors separately instead of treating missing servers as valid empty records.
- Export the results to CSV and protect the file with appropriate NTFS permissions.
- Store a dated copy in the configuration-management repository.
PowerShell commands
$servers = Get-Content .\servers.txt
$inventory = Invoke-Command -ComputerName $servers -ScriptBlock {
$os = Get-CimInstance Win32_OperatingSystem
$cs = Get-CimInstance Win32_ComputerSystem
[pscustomobject]@{ ComputerName=$env:COMPUTERNAME; OS=$os.Caption; Build=$os.BuildNumber; MemoryGB=[math]::Round($cs.TotalPhysicalMemory/1GB,2); LastBoot=$os.LastBootUpTime }
}
$inventory | Export-Csv .\windows-server-inventory.csv -NoTypeInformation -Encoding UTF8
Verification
Open the CSV, compare the number of unique computer names to the source list, and spot-check operating system build, memory, and uptime values.
Rollback
Delete superseded exports according to the retention policy. The commands are read-only and make no server configuration changes.
Operational and security notes
- Do not publish internal hostnames or IP addresses.
- Sign production scripts and log who generated each report.
- Use scheduled inventories only with a dedicated least-privilege account.
Related resources
For managed Canadian VPS and RDS infrastructure, visit networkmanager.info. See also the official Microsoft Server Manager documentation.