Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var wmiService, compSystem;
- wmiService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2");
- // the '.' denotes local system, it can be replaced with the name of the remote machine
- compSystem = wmiService.ExecQuery("Select * from Win32_ComputerSystem");
- var enumItems = new Enumerator(compSystem);
- for (; !enumItems.atEnd(); enumItems.moveNext())
- {
- var item = enumItems.item();
- WScript.echo("Logged in user: " + item.UserName);
- }
Add Comment
Please, Sign In to add comment