How to run a Hyper V VM from the command prompt

by Jun 1, 2020Software, Windows 100 comments

Run and connect to a Hyper V virtual machine without Hyper V manager from the command prompt or with a shortcut using a simple powershell script 

Commands:

Get-VM to get the names of the VMs

PS script:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force

start-vm -name “Your VM Name”

vmconnect.exe $Env:computername “Your VM Name”

CMD file:

powershell.exe powershell -Command “Start-Process PowerShell -Verb RunAs” %homedrive%%homepath%\Desktop\your-ps-script.ps1

Shortcut target:

powershell.exe %homedrive%%homepath%\Desktop\your-ps-script.ps1

Shortcut Start in:

%homedrive%%homepath%\Desktop

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Follow Me

Website created with DIVI. Get 10% discount with link below

Divi WordPress Theme Affiliate link

Recent Comments

    Stay Up to Date With The Latest News & Updates

    Join Our Newsletter

    Share This