|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by Gr8-Ideas in Powershell, Remote Desktop/Terminal Services, Windows Management Instrumentation (WMI)
Is there a way to see on a PC if there are any logged on RDP users.
The code shown works perfectly for any machine on the domain, but it does not show for logged on RDP users. It reports back the username that ran the script.
Any PS / WMI experts out there with a solution to this?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
|
"###########" | Write-Host -ForegroundColor green
""
$PCNAME = Read-Host "Please enter the computer name"
$CS = Gwmi Win32_ComputerSystem -Comp $PCNAME
$CD = Gwmi Win32_LoggedOnUser -ComputerName $PCNAME
clear
"###########" | Write-Host -ForegroundColor green
""
"Machine Name: " + $CS.Name | Write-Host -ForegroundColor red
""
"Logged On User: " + $CS.UserName | Write-Host -ForegroundColor red
""
"###########" | Write-Host -ForegroundColor green
""
|
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625