PowerTip: Start All Virtual Machines on Remote Servers Running Hyper-V

PowerTip: Start All Virtual Machines on Remote Servers Running Hyper-V

  • Comments 2
  • Likes

Summary: See how to start all virtual machines on remote servers running Hyper-V by using Windows PowerShell.

Hey, Scripting Guy! Question How can I start all virtual machines on several remote servers running Hyper-V by using Windows PowerShell?

Hey, Scripting Guy! Answer Use the pattern Get-VM | Start-VM but with the Get-VM cmdlet to specify an array of servers running Hyper-V, as shown here.

get-vm -Computer hyperv3,hyperv2 | start-vm

Use the Get-VM cmdlet to determine the status of the remote virtual machines, as shown here.

PS C:\> get-vm -Computer hyperv3,hyperv2

Name       State   CPUUsage(%) MemoryAssigned(M) Uptime   Status

----       -----   ----------- ----------------- ------   ------

dc3        Running 0           512               00:00:16 Operating normally

dc4        Running 0           512               00:00:15 Operating normally

Ex1        Running 0           4096              00:00:13 Operating normally

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • What about

    Hyperv2,hyperv3 | %{icm $_ {get-vm | start-vm} -asjob }

    To start them on multiple machines simultaneously?

  • thanks.