0
votes

I'm new to PowerCLI but not to PS.

I have a machine with ESXI with a lot of VM's. I want to iterate through all the VM's and suspend them every day at 11:59 PM. How can i do that?

Thank you, Roxbip

2
Suspend more than 10 VMs at a time and watch your vcenter admin cry.user3520245

2 Answers

0
votes
at time:11:59 /every:M,T,W,Th,F,S,Su pssuspend.exe vmware-vmx.exe

and make sure you have PsSuspend installed.

(but i still think this question should be migrated to superuser.com , its not about programming.)

0
votes

You can make use of the Suspend-VM cmdlet to do that.

Personally, I'd create a scheduled task that runs daily at 11:59PM and kicks off a script. The script could look like the following: Connect-VIServer -Server esxi.fqdn Get-VM | Suspend-VM -Confirm:$false Disconnect-VIServer -Confirm:$false

Credential handling is the next issue. You can either include it as part of the script or make use of the credential store.

If you want to use the credential store option, that can look like the following: New-VICredentialStoreItem -Host esxi.fqdn -User Admin -Password pass