1. Joined : Mar 2016
    Posts : 6
    Windows 10
       27 Mar 2016 #1

    Hyper-V Windows 10 Batch file to start/stop VM on command


    I am running Hyper-V on Windows 10.

    I am using the PC for media playback / gaming in big screen and rarely see the desktop. I have an service running and APP on my phone, so i can start batch files and programs without the need for a KB/M.

    I have just setup a VM, but i dont want it running all the time, i just want to use it to do some video rendering or whatever when i need it to, i especially don't want it to be running when playing games.

    so is there a way i could write a batch file or VBS to start the VM (not connect) then i could connect to VM via remote desktop on my laptop (or other machine)

    and another batch file to turn it off, when i want to do some gaming?

    i have googled for about an hour but came up empty
      My System SpecsSystem Spec


  2. Joined : Oct 2013
    A Finnish ex-pat in Germany
    Posts : 9,520
    Windows 10 Pro
       28 Mar 2016 #2

    The script shown in this video does exactly that:

      My System SpecsSystem Spec

  3.    28 Mar 2016 #3

    When you make Kari's powershell script put this
    Code:
    Stop-Process -processname powershell
    as the last line, and powershell will exit when you close the Virtual Machine window!
      My System SpecsSystem Spec


  4. Joined : Oct 2013
    A Finnish ex-pat in Germany
    Posts : 9,520
    Windows 10 Pro
       29 Mar 2016 #4

    flybynite said: View Post
    When you make Kari's powershell script put this
    Code:
    Stop-Process -processname powershell
    as the last line, and powershell will exit when you close the Virtual Machine window!
    Totally unnecessary.

    The video shows two ways to launch the PowerShell script, a normal shortcut and a bit more "elegant" VB script. Both ways will terminate the PowerShell process as soon as the user has closed vm window and the script has shut down the vm.

    If any additional commands would have been needed, I had added them in my instructions.
    Last edited by Kari; 29 Mar 2016 at 02:21. Reason: Typos
      My System SpecsSystem Spec


 


Similar Threads
Thread Forum
Solved Start a program from a batch file
4 Apps of mine run a batch file that -tries- to call/start and EXE program. These Batch files need to work with OS XP thru Win 10. Win 10 has a pop-up window asking user if its okay to run/execute my EXE. No other Win version does this and thus I...
Software and Apps
Batch file hide command window
I have a batch command to back up a subdirectory: xcopy "C:\All\*" "E:\Allback\*" /E /Q How can I hide the command window during the execution?
General Support
Start a program from a batch file
I'm trying to create a batch file that should - call another batch file - start a program and then wait for the program to close - call another batch file My goal with this is to work around an issue in Windows 10 where the screensaver won't...
Software and Apps
Batch file - Unable to start a program minimized
I've been trying to figure this out for a while now and I can't. I've looked at tons of small tips online to get this working but it doesn't work at all. I have a batch file which causes various programs to start when opened. However, one of them...
General Support
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 17:17.
Find Us
Twitter Facebook Google+



Windows 10 Forums