Posts

Showing posts from August, 2023

VMware PowerCLI

Rough notes on connecting to vcenters and getting vm info. Setup There's no order to this, you may need to run all of them or none of them. Get-Module -Name vmware* Import-Module -Name VMware.PowerCLI Get-VICommand Disconnect-VIServer I've had to use this on some servers, it's some weird cert issue, possible because it's not using ssl. Get-PowerCLIConfiguration Set-PowerCLIConfiguration -Scope User -InvalidCertificateAction warn Connect to VCenter server When it's looking good, try and connect to a vcenter: Connect-VIServer VcenterServer -User username -password password Shows which server you're connected to. | gm has interesting stuff. $global:DefaultVIServer Disconnect from VCenter server Disconnect-VIServer VcenterServer Get VMs If you're connecting to multiple vcenters and getting info, I think you need to disconnect from each one first, otherwise the vm count gets weird. (get-vm).count Get powered on VMs poweredoff is...aah yep. (Get-VM | where {$_.Pow