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!
> I've been told that the currently logged-in user can be found by viewing the "pae-SIDString" attribute
You've been misinformed. That tracks VM assignment to a user - i.e. it's used for permanent links in dedicated pools, not active sessions. The AD LDS database contains configuration information, session state is tracked across brokers in memory. You should continue to use Get-RemoteSession from the powershell snap-in.
Mike
My current workaround is using powershell (on the connection server) and adding the View PowerCLI Snap-In via
Add-PSSnapin VMware.View.Broker
And then running Get-RemoteSession and parsing it to get the appropriate VM and username combinations. Connecting to the ADAM database and grabbing the data from there would really open up my options as to how I obtain the data and how it's used, so any information on why that pae-SIDString is empty would be very welcomed. Thank you!
> I've been told that the currently logged-in user can be found by viewing the "pae-SIDString" attribute
You've been misinformed. That tracks VM assignment to a user - i.e. it's used for permanent links in dedicated pools, not active sessions. The AD LDS database contains configuration information, session state is tracked across brokers in memory. You should continue to use Get-RemoteSession from the powershell snap-in.
Mike
Thanks for the info, mpryor!