Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Init report array
- $report = @()
- #Server name array
- $servers = 'serverA','serverB'
- #Collect explorer info
- $users = invoke-command -computername $servers -scriptBlock {Get-WMIObject Win32_Process -filter 'name="explorer.exe"' | foreach { $_.GetOwner() } | sort user -unique}
- foreach ($u in $users)
- {
- $userData = "" | select name,server
- $userData.name = $u.user
- $userData.Server = $u.PSComputerName
- $report += $userData
- }
- $report | sort server | format-table -auto
Advertisement
Add Comment
Please, Sign In to add comment