I am looking for a script i can run in powergui which can provide me the user who is logged in to a set or all of our vm?
I did found this out there:
$vms =get-vm *vm-name* ForEach ($vmin$vms) { $QueryString=GwmiWin32_ComputerSystem-Comp$vm $QueryString =$QueryString.userName if ($QueryString-eq$null) {$vm | Set-CustomField-Name“Logged in User”-Value"No One Logged In"} ELSE {$vm | Set-CustomField-Name“Logged in User”-Value$QueryString}} Part of the results though come back like this; CustomFields : {[Logged in User, No One Logged In], [Transfer Server Status, ] , [VM Lock Status, ]} Thanks,