Reputation: 21468
How can I check if the Windows setup process is complete from a script? I have a Powershell script that runs on new builds which sometimes gets kicked off before the Windows installation is complete, but needs to wait until setup is complete to execute.
Upvotes: 1
Views: 1146
Reputation: 21468
List all processes and ensure that WinDeploy.exe is not among them. If WinDeploy.exe is running, then Windows' setup is not yet complete:
Get-Process -Name windeploy
Note that when WinDeploy.exe stops executing, you will need to ensure that the system is not rebooting before continuing, and wait until it comes back up before continuing execution. For our environment, it was easier to use the VMWare API from our deployment system to wait until WinDeploy.exe was finished executing and also check that the guest was in the running
state before attempting to execute the provisioning script.
If this is something that you have to run in a local script for whatever reason, consider using Powershell workflows which can be used across reboots.
Upvotes: 1