Friday, January 20, 2012

Poweroff Certain VMs

get-VM -Location *Proteus* | where { $_.name -ne "Proteus-C1" -And $_.name -ne "Proteus-C2" -And $_.name -ne "Proteus-C3" -And $_.name -ne "Proteus-C4" } | Stop-VM -Confirm:$false

Stop-VM (get-VM AlWinDows* |where {$_.'PowerState' -eq "PoweredOn"}) -RunAsync -Confirm:$false

$global:testIterations = 75
for($i=1; $i -le $global:testIterations; $i++){
Stop-VM (get-VM *Win* -Location Atlas-Cluster |where {$_.'PowerState' -eq "PoweredOn"}) -RunAsync -Confirm:$false
Start-Sleep -Seconds 100
Start-VM (get-VM *Win* -Location Atlas-Cluster |where {$_.'PowerState' -ne "PoweredOn"}) -RunAsync -Confirm:$false
}


get VMHost  10.2.8.51| get-VM Windows7-*| where {$_.'PowerState' -eq "PoweredOn"} | Stop-VM

1 comment:

  1. $global:testIterations = 10
    for($i=1; $i -le $global:testIterations; $i++) {
    write-host "Template to Clone"

    new-vm -Name WinAtlas$testIterations -VMhost 172.-Template Atlas_Windows_Template -Datastore Atlas-Nutanix-datastore }

    $global:testIterations = 10
    for($i=1; $i -le $global:testIterations; $i++){
    new-vm -Name WinDowsAtlas$i -VMhost 172 -Template Atlas_Windows_Template -Datastore Atlas-NTNX-datastore }

    ReplyDelete