How would I collect specific computer information and sort into a file?

I am an IT guy, and what I need to do is to somehow gather the following information:

  • Dell Service Tag
  • Computer Name
  • User Name

of all users in my network, and then sort that information into a text or Excel file.

I have tried using a VBS file, as well as creating a .bat file login script for each user, but I don't seem to be getting it to work completely.

Answers


Here is code that gives what you ask, but in the future please post what you'v got of code, as little as it often is.

'Get Dell Service Tag Info
set ProSet = GetObject("winmgmts:").InstancesOf("Win32_BIOS")
Set ProSet1 = GetObject("winmgmts:").InstancesOf("Win32_SystemEnclosure")
For each Pro in ProSet
  For each Pro1 in ProSet1
    ServiceTag=Pro.SerialNumber
    wscript.echo ServiceTag
    exit for
  Next
  exit for
Next

'get username and computername, could also be asked in a batch
Set oShell     = WScript.CreateObject("WScript.Shell")
Set oShellEnv  = oShell.Environment("Process")
sComputerName  = oShellEnv("ComputerName")
sUsername      = oShellEnv("username")
wscript.echo sComputerName & " " & sUsername

another more reliable way..

Set objWSHNetwork  = CreateObject ("WScript.Network") 
sComputerName = objWSHNetwork.ComputerName
sUsername     = objWSHNetwork.UserName
wscript.echo sComputerName & " " & sUsername

You could log the result to a database or to a textfile (An Excel file is not a good idea i'm afread) Here a logging procedure to a textfile that can lateron be opened with Excel.

sub log (user, computer)
  dim fs,f
  set fs=Server.CreateObject("Scripting.FileSystemObject")
  set f=fs.OpenTextFile(Server.MapPath(".\logging.csv"),8,true)
  f.WriteLine now & "," & user & "," & computer
  f.Close:set f=Nothing
  set fs=Nothing
end sub

Need Your Help

If url exists Objective-c

objective-c image url download exists

Hey, I have a program that needs to tell if an online image exists, but the only way that I've gotten this to work is by loading the image in a NSData pointer and checking if the pointer exists.

Filtering SharePoint list item on version number

sharepoint list filtering

I need to filter a sharepoint list based upon the version number of the list items.