Last active
July 27, 2018 14:09
-
-
Save alainassaf/c72b88ba606331ce2ca72db96a7bcc4e to your computer and use it in GitHub Desktop.
Getting, counting, saving
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Retrieve the information | |
$XenServerVMs = Get-XenVM | Where-Object {$_.is_a_snapshot -eq $false -and $_.is_a_template -eq $false -and $_.is_control_domain -eq $false -and $_.power_state -eq 'running'} | Select-Object name_label | |
$vmCount = $XenServerVMs.count | |
$objctxsrv = new-object System.Object | |
$objctxsrv | Add-Member -type NoteProperty -name XenServer -value $xsn | |
$objctxsrv | Add-Member -type NoteProperty -name 'VM Count' -value ($vmCount) | |
$finalout += $objctxsrv | |
# Disconnect from the XenServer pool | |
Get-XenSession -Server $_ | Disconnect-XenServer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment