HI gurus
I am looking to get a list of VDI from a folder and brin the following information:
VDI name(Name-xxx) , IP address of the VDI and the username
I have so far this but got stuck.
"get-folder Folder | get-vm | select name,@{N="IP";E={@($_.Guest.IPAddress)}}", this brings the VDI name and the IP address but I can't find how to bring the username assigned to this machines
Thanks for any help
Ciao
When you talk about VDI do you mean virtual machines assigned to a Horizon infrastructure? So you need to know which users are assigned via Horizon to that VM?
Fabio.
You are correct, Horizon , VDI machine name, ip and user assigned to that VDI
Thanks
Ciao
try this script
#####
$User = Get-Credential
$VMFolder = "<FolderofVM>"
$vcenterserver = "<FQDNvCenter>"
$connectionServer = "<FQDNConnectionServer>"
$ExportFilePath = "c:\temp\Export-VMInfo.csv"
Connect-ViServer $vcenterserver -Credential $User
Connect-HvServer -server $connectionServer -User <domain\user> -Password <password>
$Report = @()
$VMs = Get-Folder $VMFolder | Get-VM
ForEach ($VM in $VMs) {
$VMInfo = {} | Select VMName,IPAddress,UserHorizon
$VMInfo.VMName = $vm.name
$VMInfo.IPAddress = $vm.Guest.IPAddress[0]
$HVM = get-hvmachinesummary -MachineName $VM | Select-Object @{Name='User';Expression={$_.NamesData.Username}}
$VMInfo.UserHorizon = $HVM.User
$Report += $VMInfo
}
$Report = $Report | Sort-Object VMName
IF ($Report -ne "") {
$report | Export-Csv $ExportFilePath -NoTypeInformation
}
######
For install of Horizon Powercli (Connect-HvServer and get-hvmachinesummary) check this link
Set Up the Horizon PowerCLI Module (vmware.com)