Hi there,
Using VMware View 4.5. Users come and go in our Company on a regular basis, all of which are assigned a VMware View desktop during their time. I am trying to find a way to free up VMs of Users who have left. We are using persistent desktops for a specific reason.
These Users are removed from AD soon after they leave. They could leave their VM is a Disconnected or Available state.
Is there a Powershell command to find out the last time a User has logged on - has been disconnected for x duration - of if a User isn't in AD but assigned a desktop on a Pool
I could then use this information to unassign Desktops (scripted).
Any thoughts or help would be appreciated.
Best Regards,
Paul.
You could try the vdmadmin -O command from a connection broker. That command shows assigned machines that are unentitled.
Do you mean the unassigned user connected and disconnected? No that one means someone is logged into the VM that is not assigned that VM. The vdmadmin -0 reports on VM's that are assigned to users who no longer have access to the pool (they could have been deleted from AD or something).
Created a quick VBS script to check against a list of exported Users from VMware View (Users.txt) against deleted accounts in AD if its of any assistance, maybe somewhere else... cheap and cheerful.
********************************************************************************************************************************************
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\temp\Users.txt", ForReading)
Const ForReading = 1
Dim arrFileLines()
Dim myFSO, Update
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set Update = myFSO.OpenTextFile("c:\temp\Deleted_Accounts.txt", 8, True)
i = 0
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
strUserName = arrFileLines(i)
dtStart = TimeValue(Now())
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://dc=eu, dc=ad, dc=my_company,dc=com>;(&(objectCategory=User)" & _
"(samAccountName=" & strUserName & "));samAccountName;subtree"
Set objRecordSet = objCommand.Execute
If objRecordset.RecordCount = 0 Then
Update.WriteLine(strUserName)
Else
End If
i = i + 1
Loop
SET Update = NOTHING
SET myFSO = NOTHING
objFile.Close
objConnection.Close
'Update.Close
********************************************************************************************************************************************
Exports list of Users to a text file.
E&OE !
Paul.