Quite a number of clients are running a virtual Citrix environment, so here is a script to get a list of basic details on each VM such as name, state, IP address, VM host, and memory. You will need to modify the value of the $VIserver variable.
# load the PowerCLI cmdlets
Import-Module VMware.PowerCLI
# name or IP of the vCenter server
$VIserver = 'vcenter.domain.com'
# where to store the output
$outputFile = 'c:\temp\VMlist.csv'
# retrieve the vCenter creds
$creds = Get-Credential
# connect to vCenter
Connect-VIServer $VIserver -Credential $creds
# retrieve and format the information from vCenter
Get-VM | Sort-Object PowerState, Name |
Select-Object -Property `
@{n='IP Address'; e={$_.guest.IPAddress[0]}},
@{n='VM Host'; e={$_.VMHost}},
@{n='Memory'; e={"$([math]::Round($_.MemoryGB))GB"}},
@{n='State'; e={$_.PowerState.toString().Substring(7)}} |
Export-Csv -Path $outputFile -NoTypeInformation
# disconnect from vCenter - no need to confirm
Disconnect-VIServer -Confirm:$false
Sam Jacobs is the Director of Technology at Newtek Technology Solutions (formerly IPM, the longest standing Citrix Platinum Partner on the East Coast). With more than 40 years of IT consulting, Sam is a Citrix NetScaler, StoreFront, and Web Interface customization and integration expert. He holds Microsoft Azure Developer and Citrix CCP-N certifications, and was a frequent contributor to the CUGC CTP blog. He has presented advanced breakout sessions at Citrix Synergy for 6 years on ADC (NetScaler) and StoreFront customizations and integration. He is one of the top Citrix Support Forum contributors, and has earned industry praise for the tools he has developed to make NetScaler, StoreFront, and Web Interface easier to manage for administrators and more intuitive for end users. Sam became a Citrix Technology Professional (CTP) in 2015, and can be reached at sjacobsCTP@gmail.com.