start

Starting and Stoping a Powershell Script as a Job

You may start your script as a job.

start-job -scriptblock {. Pathofyourscript.ps1}

Then stop the job if CTRL+C is pressed:

[console]::TreatControlCAsInput = $true
while ($true) {

     Start-Sleep -s 30

     if ([console]::KeyAvailable) {

         $key = [system.console]::readkey($true)
         if (($key.modifiers -band [consolemodifiers]"control") -and ($key.key -eq "C")) { "Terminating..." }

    } 

        get-job | stop-job

        break
   }
    }
}

ESXi Command Line Start Guest VM

Get list of Guest VM IDs on host:
vim-cmd vmsvc/getallvms

Power on the virtual machine using the VMID found in Step 2 and run:
vim-cmd vmsvc/power.on <vmid>

Using the ESXi 5.0 esxcli command to power off or power on a virtual machine

How to stop a Guest VM from Command line: <SSH or ESXi Shell>

The esxcli command can be used locally or remotely to power off a virtual machine running on ESXi 5.0. For more information, see the esxcli vm Commands section of the vSphere Command-Line Interface Reference.

Subscribe to RSS - start