Answer the question
In order to leave comments, you need to log in
How to resume running a PowerShell script after a computer restart?
You often need to deploy new Hyper-V hosts. To make my work easier and protect myself from human errors, I decided to write a script similar to the one described in the book "Windows Server 2012 Hyper-V Installation and Configuration Guide": the script renames the host, enables RDP, raises the Hyper-V and FC roles, creates virtual switches, bla -blah blah. In short, a lot of work and 2 reboots. It is necessary to somehow continue the execution of the script from the place where it was interrupted by the reboot after turning on the same Hyper-V. Otherwise, you have to enter a lot of passwords and click a lot, which is not feng shui.
Somewhere I heard that Server Manager since WS 2012 works entirely on PowerShell. It successfully continues installing and configuring roles even after a reboot, I want the same. How?
Answer the question
In order to leave comments, you need to log in
The first option, obvious and crooked, is to farm with a scheduler and semaphore files.
The second, more elegant option is to master remoting, run scripts on another machine, clinging to the target machine through Invoke-PSSession. The ultimate development of the second option is to master ansible (+ playbooks), deploy an automation server, run all automation tasks on it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question