My goal is to get a report, via Powershell, of which users are logged into which View VMs. We utilize linked-clones and have multiple linked-clone pools. My current method of getting the currently logged-in user is using WMI, via Powershell. However, that method is not 100% reliable and I really want the report to reflect exactly what I would see in View Administrator. I've been told that the currently logged-in user can be found by viewing the "pae-SIDString" attribute for a given CN in the Server's OU within the View ADAM database. However, the pae-SIDString attribute is "<not set>" for every CN in the Servers OU within the View ADAM database! Here is the Powershell script I'm using (I've also verified the pae-SIDString is blank by connecting to the ADAM database with ADSIEdit)
Add-PSSnapin quest.activeroles.admanagement
$adam = "MyViewConnectionServer.MyDomain.Com"
$me = (Get-Credential)
Connect-QADService -Credential $me -Service $adam
$vms = Get-QADObject -SearchRoot 'OU=Servers,DC=vdi,DC=vmware,DC=int' -type pae-VM
foreach ($vm in $vms) {
$parent = Get-QADObject $vm -IncludeAllProperties
if ($parent."pae-SIDString"){
$usr = (Get-QADObject -Identity $parent."pae-SIDString").DirectoryEntry.description | select -last 1
write-host "$usr"
}
}
Can someone help me figure out
1) Why the pae-SIDString is empty/blank for all of my VMs when there are logged-in users according to View Administrator
2) Are there any other methods of getting the currently logged-in user that reflect exactly what I would see within View Administrator?
Thanks!