Get the App
SLTechnology News&Howtos  ›  Servers  › 

Using PowerCLI to automatically obtain vSphere storage capacity data

Shulou Source: shulou.com Published: 2022-06-03 08:58:28 10月03日 Update

Objective: to realize the automatic acquisition of vSpherec storage capacity metadata, which is convenient for capacity prediction and analysis.

Code:

# add trusted add-pssnapin vmware.vimautomation.coreConnect-VIServer-server Vsphere_IP-Protocol https-User Username-Password User_password$time=Get-Date-Format "yy/MM/dd-HH:mm" # to get shared storage You can use Nameget-datastore to regularly match the storage information you want to obtain | where {$_. Name-match "storage_name1"} | Select-Object Name,FreeSpaceGB,CapacityGB | Export-Csv-Append C:\ storage1.csv# to get Lenovo get-datastore | where {$_. Name-match "storage_name2*"} | Select-Object Name,FreeSpaceGB,CapacityGB | Export-Csv-Append C:\ storage2.csv$time | Out-File-Append C:\ storage1.csv$time | Out-File-Append C:\ storage2.csvDisconnect-VIServer-Confirm:$false

Tags: Storage capacity data code information regularity purpose analysis Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi Shulou Information Apple Linux