How To Collect System Info With Login Script
Save this as a .vbs file:
—————————————————————————–
Dim strComputer
Dim objFS
Dim objFile
Set objFS = CreateObject(“Scripting.FileSystemObject”)
Set objFile = objFS.OpenTextFile(“P:AdminComputerLogLOGINLOG.txt”, 8, True)
Dim WshNetwork
Set WshNetwork = WScript.CreateObject(“WScript.Network”)
objFile.WriteLine “Domain = ” & WshNetwork.UserDomain
objFile.WriteLine “Computer Name = ” & WshNetwork.ComputerName
objFile.WriteLine “User Name = ” & WshNetwork.UserName
On Error Resume Next
Const HKLM = &H80000002 ‘HKEY_LOCAL_MACHINE
Set oReg = GetObject(“winmgmts:{impersonationLevel=impersonat e}!\” _
& sNode & “/root/default:StdRegProv”)
If Err.Number <> 0 Then
GetOfficeVer = -1
End If
Dim oOffice
Set oOffice= CreateObject(“Outlook.Application”)
objFile.WriteLine “Office Version = ” & oOffice.Version
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\” & strComputer & “rootcimv2”)
Set colSMBIOS = objWMIService.ExecQuery (“Select * from Win32_SystemEnclosure”)
For Each objSMBIOS in colSMBIOS
objFile.WriteLine “Service Tag: ” & objSMBIOS.SerialNumber
Next
objFile.WriteLine “—————————————–”
objFile.Close
WScript.Quit
—————————————————————————–
Call the .vbs file using this command (which can be put in your login script)
cscript //NoLogo \servernamenetlogongetservicetag.vbs
The above script collects the Service Tag and Office version and writes them to a text file with the username.
SysSpec
For more detailed information about the computer, use SysSpec. You can use this line to call SysSpec from the login script:
P:AdminComputerLogsysspec.exe /auto P:AdminComputerLog%username%-specs.txt