Quantcast
Channel: VMware Communities : All Content - VMware vCenter™
Viewing all articles
Browse latest Browse all 24426

VMware-PowerCLI script

$
0
0

Hello!

 

I created this VMware-PowerCLI script:

 

Connect-VIServer -Server vcenter.local -Protocol https -User 'mmarnauza' -Password 'pass'

 

$vm = Get-VM -Name mm.Workstation8

Shutdown-VMGuest -VM $vm -Confirm:$false

 

echo "SHUTWOWN $vm IN PROGRESS Sleep 10"

Start-Sleep -Seconds 10

 

It connects to vCenter and does guest shutdown of mm.Workstation8 virtual machine.

 

At the end I want to create script that's:

 

1) lists all the VMs in vCenter

2) shuts down all the VMs except vcenter

 

I want to do script in a way that if I add new VMs I do not modify the script! Anyone can help me with this since I am not very good with scripting


Viewing all articles
Browse latest Browse all 24426

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>