1

I'm trying to make a script that continues after a reboot. In short the script is there to deploy a PC for in the field use so the script runs local on a local machine, ideally from a thumb drive. A user inserts the drive and runs the script, from there it should not require any actions by the user. The script should then reconfigure the network adapters and enable the Hyper-V Windows feature (this bit is working). After this the PC needs to restart and continue with importing a VM (this bit is working as well).

Since the user will not have any IT related knowledge the script needs to show a PowerShell window after it has rebooted where it outputs the result of the VM import. Ideally I would like to have the script log itself on automatically as all PC come default with the same password.

workflow Reboot-Resume {
    "Hello World, I'm going to reboot!"
    Restart-Computer -Wait
    "This should be printed to a PowerShell window"
}

Unfortunately the above snippet is not working as when the PC is rebooted the workflow job is suspended. Execution policy is set to "unrestricted". Manually resume the job will not pop-up a shell with "This should be printed to a PowerShell window" printed.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.