BSModlin
asked on
Create Powershell script to Start VM
I have a Server 2012 R2 Hyper-V box that is scheduled to restart every night. When the server comes back up, all VMs automatically start except an RSA Authentication MGR Linux VM. I have checked the Hyper-V settings and it is set to restart automatically like the others, but does not.
To get it started, I must do a GPUPDATE /FORCE, and then start the VM and poof, it works.
With that being said, I would like to run a powershell script that runs at COMPUTER startup that will run a GPUPFDATE /FORCE, pause for like 120 seconds, and then issue a start command to that particular VM.
Can somebody help?
To get it started, I must do a GPUPDATE /FORCE, and then start the VM and poof, it works.
With that being said, I would like to run a powershell script that runs at COMPUTER startup that will run a GPUPFDATE /FORCE, pause for like 120 seconds, and then issue a start command to that particular VM.
Can somebody help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
1. from an elevated powershell session (run as administrator)
set-executionpolicy remotesigned
accept the change in the policy as by default scripts are disabled.
create a scheduled task trigger on machine startup
task
C:\Windows\System32\Window sPowerShel l\v1.0\pow ershell.ex e
argument
c:\path\yourscriptname.ps1
http://windows.microsoft.com/en-ca/windows/schedule-task#1TC=windows-7
set-executionpolicy remotesigned
accept the change in the policy as by default scripts are disabled.
create a scheduled task trigger on machine startup
task
C:\Windows\System32\Window
argument
c:\path\yourscriptname.ps1
http://windows.microsoft.com/en-ca/windows/schedule-task#1TC=windows-7
ASKER