Skip to content

Currently logged in users

Featured Replies

Hi All,

 

Can someone help me with a script (Powershell or VB) to populate the currently logged in username from Computers ?

 

What I have ?

 

A spreadsheet with Computer names.

 

Eg:

COMP001

COMP002

.

.

.

COMP00n

 

What I am looking for ?

 

A script that reads Computer names from the spreadsheet and finds the currently logged in users on these computer and export the details to another spreadsheet in a something similar format.

 

COMP001 Adam

COMP002 Brian

 

I tried some scripts which I got from different forums out there but I am not getting what I am trying to achieve.

 

Thanks,

Joe

I have used:

$ComputerlistPath = 'c:\temp\computerlist.txt'
$ComputerList = Get-Content -Path $ComputerlistPath; # one computer a line
foreach ($computer in $computerList){
    ($computer + ": " + @(Get-WmiObject -ComputerName $computer -Namespace root\cimv2 -Class Win32_ComputerSystem)[0].UserName);
}

To get this information a few times. you can probably use this as a basis to make a script do what you want.

  • Author

Thanks a ton...

 

I've tried this on my local machine and it works perfectly. I just need to redirect the result to an excel file which is not a big deal

 

However, I still need to give it a try inside my office network and see how it works.

 

Will come back with the updates.

 

Thanks again.

  • 8 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.