![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Script to find all user and what PC they are logged into The script below works fine for a single PC but I need to get all computers and users in the domain. Any suggestions. On Error Resume Next Dim System if Wscript.Arguments.Count >0 then sSystem=Wscript.Arguments(0) end if if sSystem="" then sSystem=Inputbox("Enter a computer name to target.","WMI System Info") if sSystem ="" then wscript.Quit end if end if Wscript.echo "Getting system information for " & sSystem & VBCRLF Set System=GetObject("winmgmts:{impersonationLevel=impersonate}!//"&sSystem&"/root/cimv2:Win32_ComputerSystem="&chr(34)&sSystem&chr(34)) if err.number<>0 then wscript.echo "Error with " & sSystem wscript.echo "(" & err.number & ") "& err.description wscript.quit else sInfo="System Name:" & chr(9) & System.Caption & VBCRLF sInfo=sInfo & "Primary Owner:" & chr(9) & System.PrimaryOwnerName & VBCRLF sInfo=sInfo & "Current User:" & chr(9) & System.UserName & VBCRLF sInfo=sInfo & "Current Domain:" & chr(9) & System.Domain & VBCRLF end if Set oWMI = GetObject("winmgmts:") For Each bios In oWMI.InstancesOf("Win32_BIOS") Wscript.echo "PC Serial Number: " & bios.SerialNumber Next MsgBox sInfo,0+64,"WMI System Info" set System=Nothing set sInfo=Nothing Wscript.quit |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Script to find all user and what PC they are logged into "Terry" <terry@xxxxxx> wrote in message news:FF334D11-4688-437A-8F1E-8C66F74EF070@xxxxxx Quote: > The script below works fine for a single PC but I need to get all > computers and users in the domain. Any suggestions. > > On Error Resume Next > Dim System > > if Wscript.Arguments.Count >0 then > sSystem=Wscript.Arguments(0) > end if > > if sSystem="" then > sSystem=Inputbox("Enter a computer name to target.","WMI System Info") > if sSystem ="" then > wscript.Quit > end if > end if > > Wscript.echo "Getting system information for " & sSystem & VBCRLF > > Set > System=GetObject("winmgmts:{impersonationLevel=impersonate}!//"&sSystem&"/root/cimv2:Win32_ComputerSystem="&chr(34)&sSystem&chr(34)) > > if err.number<>0 then > wscript.echo "Error with " & sSystem > wscript.echo "(" & err.number & ") "& err.description > wscript.quit > else > sInfo="System Name:" & chr(9) & System.Caption & VBCRLF > sInfo=sInfo & "Primary Owner:" & chr(9) & System.PrimaryOwnerName & VBCRLF > sInfo=sInfo & "Current User:" & chr(9) & System.UserName & VBCRLF > sInfo=sInfo & "Current Domain:" & chr(9) & System.Domain & VBCRLF > > > end if > > Set oWMI = GetObject("winmgmts:") > For Each bios In oWMI.InstancesOf("Win32_BIOS") > Wscript.echo "PC Serial Number: " & bios.SerialNumber > Next > MsgBox sInfo,0+64,"WMI System Info" > > set System=Nothing > set sInfo=Nothing > > Wscript.quit > http://www.rlmueller.net/Inventory.htm This example inventories all computers in the domain. It uses ADO to retrieve information on all computers. It pings each computer to see if it is available, then uses WMI to connect remotely and retrieve more information. Error trapping is used in case the computer cannot be contacted. The results are written to an Excel spreadsheet. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Conditional execution of script for logged-on user | VB Script | |||
| Windows could not find your user profile so it logged in to a temporary account.....! | Vista account administration | |||
| script to find a certain info about a user | PowerShell | |||
| Cant find my standard user account files when logged in as Admin?? | Vista account administration | |||
| User Profile Bad if this user is not first user logged onto Vista | Vista account administration | |||