Skip to main content

Update Windows Server 2019

Summary​

Upgrades a server to Windows Server 2019 in place. Apps, settings, and data stay on the server.

The script runs Windows Setup silently from your Windows Server 2019 media, then restarts the server to finish the upgrade. The media can be on the server or a network share, or the script can download the ISO from a web address. Servers already on Windows Server 2019 or later are not changed.

It works by running the Update-WindowsServer2019 PowerShell script.

warning

The server restarts 60 seconds after Windows Setup finishes its first phase. The upgrade then takes 30 to 90 minutes, with more restarts. The server and its Automate agent are offline during this time. Run this script inside a maintenance window.

note

Microsoft supports upgrades to Windows Server 2019 from Windows Server 2012 R2 and Windows Server 2016 only. Evaluation editions must be converted to a licensed edition first. See Troubleshooting.

Sample Run​

Example 1: Run the script with URL, ImageIndex, and ProductKey

Image1

Example 2: Run the script with Source, ImageIndex, ProductKey

Image2

Dependencies​

Requirements​

  • Windows Server 2012 R2 or Windows Server 2016, Standard or Datacenter.
  • PowerShell 5 or later. Windows Server 2012 R2 needs Windows Management Framework (WMF) 5.1.
  • Internet access to contentrepo.net, where the script downloads the latest signed copy of the PowerShell script.
  • Windows Server 2019 installation media in the same language as the server.
  • When you use Url: about 6 GB of free space on the system drive for the download, in addition to the space Windows Setup needs.

Global Variables​

NameValueAccepted ValuesDescription
DebugFalseFalse, TrueWhen True, enables informational logging; when False (default), informational logs are suppressed to avoid adding entries to the h_scripts table. Set to True to assist with troubleshooting.
ScriptEngineEnableLoggerFalseFalse, TrueWhen True, enables final (success/failure) logging; when False (default), these logs are suppressed to avoid adding entries to the h_scripts table. Set to True to assist with troubleshooting.

User Parameters​

Set Source or Url. If you set both, the script uses Source and ignores Url.

NameExampleRequiredDescription
SourceC:\ISO\Server2019.isoTrue (Semi)The ISO file, or a folder or drive that holds the Windows Server 2019 media. Use D:\ for an ISO attached to a virtual machine as drive D:. Required unless you set Url.
Urlhttps://fileserver.contoso.com/iso/Server2019.isoTrue (Semi)HTTP or HTTPS address of a Windows Server 2019 ISO file on a file server. The script downloads the ISO and deletes it after setup. Ignored when Source is set. Required unless you set Source.
ImageIndex4FalseThe image to install from the media. Leave blank or set to 0 to pick the image that matches the server's edition and type. Set a number to change edition, such as Standard to Datacenter.
ProductKeyXXXXX-XXXXX-XXXXX-XXXXX-XXXXXFalseProduct key for media that asks for one. Retail media usually does. The key is never written to the logs.
note

A network share in Source must be readable by the server's computer account, because the script runs as SYSTEM. If it is not, copy the ISO to the server or use Url.

Results by Server​

ServerResult
Windows Server 2012 R2 or 2016, all requirements metSuccess. Setup finishes its first phase and the server restarts after 60 seconds to complete the upgrade.
Windows Server 2019 or newerSuccess. No changes.
Evaluation editionFailure. No changes. Convert to a licensed edition and run again.
Windows desktop operating systemFailure. No changes. This script upgrades Windows Server only.
Media is not Windows Server 2019, or cannot be foundFailure. No changes.
Windows Setup finds a problemFailure. No restart. Setup logs are in C:\$WINDOWS.~BT\Sources\Panther.

You'll know it worked when you run the script again after the upgrade and it reports that the server already runs Windows Server 2019.

Troubleshooting​

ProblemCauseSolution
Neither Source nor Url was providedBoth parameters were left blank.Set Source or Url and run again.
Url must be an HTTP or HTTPS URLUrl is not a complete web address.Enter the full address, starting with http:// or https://.
Failed to download the agnostic scriptThe server cannot reach contentrepo.net, and no earlier copy of the script is on the server.Allow access to contentrepo.net, or check that security software is not blocking the download.
Failed to execute the powershell scriptSecurity software blocked the script.Allow PowerShell scripts in C:\ProgramData\_Automation\Script\Update-WindowsServer2019.
Invalid SignatureThe script's code signature could not be verified.Run the script again. If it still fails, contact ProVal support.

For upgrade failures, such as media or Windows Setup errors, see Troubleshooting in the PowerShell script document.

Output​

  • Script log
  • Script logs on the server:
    • C:\ProgramData\_Automation\Script\Update-WindowsServer2019\Update-WindowsServer2019-log.txt
    • C:\ProgramData\_Automation\Script\Update-WindowsServer2019\Update-WindowsServer2019-error.txt

Changelog​

2026-11-12​

  • Initial version of the document.