CNWHUD/shell-frags/RackRentalVirtualPowerMgmt/esxi-PowerCycle.ps1

10 lines
458 B
PowerShell
Raw Normal View History

2023-11-25 18:44:05 +00:00
param(
[string]$vcenter,
[string]$vm
)
Get-Module -ListAvailable PowerCLI* | Import-Module -Verbose:$false > /dev/null
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false > /dev/null
Connect-ViServer -Server $vcenter -User tplab\powervtps -Password h7x14vFGkJr5 -Verbose:$false > /dev/null
Stop-VM -RunAsync -VM "$vm" -Confirm:$false -Verbose:$false > /dev/null
Start-VM -RunAsync -VM "$vm" -Confirm:$false -Verbose:$false > /dev/null