home *** CD-ROM | disk | FTP | other *** search
- Dim FSO, shell, xslProcessor
-
-
-
- Sub GetOSInfo(outputFileName)
- On Error Resume Next
-
- strComputer = "."
- HKEY_LOCAL_MACHINE = &H80000002
-
- Dim objReg, outputFile
- Dim buildDetailNames, buildDetailRegValNames
-
- buildDetailNames = Array("Product Name", "Version", "Build Lab", "Type")
- buildDetailRegValNames = Array("ProductName", "CurrentVersion", "BuildLabEx", "CurrentType")
-
- Set outputFile = FSO.OpenTextFile(outputFileName, 2, True)
-
- Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
- strComputer & "\root\default:StdRegProv")
-
- outputFile.WriteLine("[Architechture/Processor Information]")
- outputFile.WriteLine()
- outputFile.Close
- cmd = "cmd /c set processor >> " & outputFileName
- shell.Run cmd, 0, True
-
- Set outputFile = FSO.OpenTextFile(outputFileName, 8, True)
-
- outputFile.WriteLine()
- outputFile.WriteLine("[Operating System Information]")
- outputFile.WriteLine()
-
- strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
- for I = 0 to UBound(buildDetailNames)
- objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, buildDetailRegValNames(I), info
- outputFile.WriteLine(buildDetailNames(I) + " = " + info)
- Next
-
- outputFile.WriteLine()
- strKeyPath = "SYSTEM\SETUP"
- objReg.GetDWordValue HKEY_LOCAL_MACHINE, strKeyPath, "Upgrade", upgradeInfo
- if IsNull(upgradeInfo) Then
- outputFile.WriteLine("This is a clean installed system")
- Else
- outputFile.WriteLine("This is an upgraded system")
- End If
-
- outputFile.WriteLine(buildDetailNames(I) + " = " + info)
-
- outputFile.WriteLine()
- outputFile.WriteLine("[File versions]")
- outputFile.WriteLine()
-
- Set shell = WScript.CreateObject( "WScript.Shell" )
- windir = shell.ExpandEnvironmentStrings("%windir%\system32\")
-
- Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
-
- Dim FileSet
- FileSet = Array("onex.dll", "dot3api.dll", "dot3cfg.dll", "dot3dlg.dll", "dot3gpclnt.dll", "dot3gpui.dll", "dot3msm.dll", "dot3svc.dll", "dot3ui.dll")
- For Each file in FileSet
- filename = windir + file
- strQuery = "Select * from CIM_Datafile Where Name = '" + Replace(filename, "\", "\\") + "'"
- Set fileProp = objWMIService.ExecQuery _
- (strQuery)
-
- For Each objFile in fileProp
- outputFile.WriteLine(file + " " + objFile.Version)
- Next
- Next
-
- call GetBatteryInfo(outputFile)
- outputFile.Close
-
- Set outputFile = FSO.OpenTextFile(outputFileName, 8, True)
- outputFile.WriteLine("")
- outputFile.WriteLine("[System Information]")
- outputFile.WriteLine("")
- outputFile.Close
-
- 'Comments: Dumping System Information using "systeminfo" command
-
- cmd = "cmd /c systeminfo >> " & outputFileName
- shell.Run cmd, 0, True
-
- Set outputFile = FSO.OpenTextFile(outputFileName, 8, True)
- outputFile.WriteLine("")
- outputFile.WriteLine("[User Information]")
- outputFile.WriteLine("")
- outputFile.Close
-
- cmd = "cmd /c set u >> " & outputFileName
- shell.Run cmd, 0, True
-
- End Sub
-
- Sub GetBatteryInfo(outputFile)
- On Error Resume Next
- strComputer = "."
- outputFile.WriteLine()
- outputFile.WriteLine("[Power Information]")
- outputFile.WriteLine()
- Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
- Set colItems = objWMIService.ExecQuery("Select * from Win32_Battery")
- if colItems.Count = 0 Then
- outputFile.WriteLine("It is a Desktop running on AC")
- Else
- For Each objItem in colItems
- if objItem.Availability = 2 Then
- outputFile.WriteLine("Machine is running on AC Adapter")
- Else
- if objitem.Availability = 3 Then
- outputFile.WriteLine("Machine is running on Battery")
- End If
- End If
- Next
- End If
- End Sub
-
- Sub GetAdapterInfo(outputFile)
- On Error Resume Next
- Dim adapters, objReg
- Dim adapterDetailNames, adapterDetailRegValNames
-
- adapterDetailNames = Array("Driver Description", "Adapter Guid", "Hardware ID", "Driver Date", "Driver Version", "Driver Provider")
- adapterDetailRegValNames = Array("DriverDesc", "NetCfgInstanceId", "MatchingDeviceId", "DriverDate", "DriverVersion", "ProviderName")
-
-
- HKEY_LOCAL_MACHINE = &H80000002
- strComputer = "."
-
- Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
- strComputer & "\root\default:StdRegProv")
-
-
- strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
-
- objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, adapterSet
-
- For Each adapter In adapterSet
- If StrComp("Properties", adapter) Then
- fullstrKeyPath = strKeyPath + adapter
- objReg.GetDWORDValue HKEY_LOCAL_MACHINE, fullstrKeyPath, "*IfType", ifType
- If ifType = 6 Then
- for I = 0 to UBound(adapterDetailNames)
- objReg.GetStringValue HKEY_LOCAL_MACHINE, fullstrKeyPath, adapterDetailRegValNames(I), info
- outputFile.WriteLine(adapterDetailNames(I) + " = " + info)
- Next
- outputFile.WriteLine()
- End If
- End If
- Next
- End Sub
-
-
-
- Sub GetEnvironmentInfo(outputFileName)
- On Error Resume Next
- Dim envInfoFile
-
- Set objShell = WScript.CreateObject( "WScript.Shell" )
-
- cmd = "cmd /c netsh lan show interfaces > " & outputFileName
- objShell.Run cmd, 0, True
-
- cmd = "cmd /c netsh lan show settings >> " & outputFileName
- objShell.Run cmd, 0, True
-
- cmd = "cmd /c netsh lan show profiles >> " & outputFileName
- objShell.Run cmd, 0, True
-
- cmd = "cmd /c ipconfig /all >> " & outputFileName
- objShell.Run cmd, 0, True
-
- Set envInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
- envInfoFile.WriteLine("")
- envInfoFile.WriteLine("Machine certificates...")
- envInfoFile.WriteLine("")
- envInfoFile.Close
-
- cmd = "cmd /c certutil -v -store -silent My >> " & outputFileName
- objShell.Run cmd, 0, True
-
- Set envInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
- envInfoFile.WriteLine("")
- envInfoFile.WriteLine("User certificates...")
- envInfoFile.WriteLine("")
- envInfoFile.Close
-
- cmd = "cmd /c certutil -v -store -silent -user My >> " & outputFileName
- objShell.Run cmd, 0, True
- End Sub
-
- 'Comments: Function to dump a tree under a registry path into a file
- Sub DumpRegKey(outputFileName,regpath)
- On Error Resume Next
- Dim cmd
-
- Set objShell = WScript.CreateObject( "WScript.Shell" )
-
- cmd = "cmd /c reg export " & regpath & " " & outputFileName & " /y"
- objShell.Run cmd, 0, True
-
- End Sub
-
- Sub DumpAllKeys
- On Error Resume Next
- Dim NotifRegFile, RegFolder, Key
-
- RegFolder = "Reg"
-
- if Not FSO.FolderExists(RegFolder) Then
- FSO.CreateFolder RegFolder
- End If
-
- LMDot3SvcRegFile = RegFolder + "\HKLMDot3Svc.reg.txt"
- CUDot3SvcRegFile = RegFolder + "\HKCUDot3Svc.reg.txt"
- LGPPolicyFile = RegFolder + "\L2GP.reg.txt"
-
- call DumpRegKey(LMDot3SvcRegFile ,"""HKLM\SOFTWARE\Microsoft\dot3svc""")
- call DumpRegKey(CUDot3SvcRegFile ,"""HKCU\SOFTWARE\Microsoft\dot3svc""")
- call DumpRegKey(LGPPolicyFile ,"""HKLM\SOFTWARE\Policies\Microsoft\Windows\WiredL2\GP_Policy""")
- End Sub
-
- Sub FormatTrace(basename, tmfPath, omitLevels)
- On Error Resume Next
-
- Dim subdir
- subdir = "traces\"
- Dim cmd
- cmd = "tracerpt """ & subdir & basename & ".etl"" -o """ & subdir & basename & ".xml"" -summary """ & subdir & basename & ".sum"" -tmf """ & tmfPath & """ -y"
-
- Dim exitcode
- exitcode = shell.Run(cmd, 0, True) ' run synchronous and hide the window
- If exitcode <> 0 Then
- Err.Raise exitcode, "gatherWiredInfo.FormatTrace", "tracerpt failed"
- End If
-
- FSO.DeleteFile subdir & basename & ".sum"
-
- Const ForReading = 1
- Const TristateFalse = 0
- Dim ansiFile
- Set ansiFile = FSO.OpenTextFile(subdir & basename & ".xml", ForReading, False, TristateFalse)
-
- xslProcessor.Input = CreateObject("MSXML2.DOMDocument.6.0")
- xslProcessor.Input.Async = False
- xslProcessor.Input.ValidateOnParse = True
- If Not xslProcessor.Input.LoadXml(ansiFile.ReadAll()) Then
- Err.Raise xslProcessor.Input.ParseError.ErrorCode, "gatherWiredInfo.FormatTrace", basename & ".xml line " & xslProcessor.Input.ParseError.Line & " column " & xslProcessor.Input.ParseError.LinePos & ": " & xslProcessor.Input.ParseError.Reason
- End If
-
- Dim output
- Set output = FSO.CreateTextFile(subdir & basename & ".txt", True, True)
-
- xslProcessor.AddParameter "omit-levels", " " & omitLevels & " "
- xslProcessor.Reset
- xslProcessor.Transform
-
- Dim buf
- Do
- ' FSO text file doesn't implement IStream, have to flush internal buffer manually
- buf = xslProcessor.Output
- output.Write buf
- Loop While buf <> ""
-
- ansiFile.Close
- FSO.DeleteFile subdir & basename & ".xml"
- End Sub
-
- Sub FormatEventLog(basename)
- On Error Resume Next
- Dim subdir
- subdir = "eventlog\"
- if Not FSO.FolderExists(subdir) Then
- FSO.CreateFolder subdir
- End If
-
- Dim cmd
-
- Set objShell = WScript.CreateObject( "WScript.Shell" )
-
- cmd = "cmd /c tracerpt -y -of EVTX " + basename + ".etl -o " + subdir + basename + ".evtx"
- objShell.Run cmd, 0, True
-
- End Sub
-
-
- On Error Resume Next
-
- Dim adapterInfoFile, netInfoFile
-
- Set FSO = CreateObject("Scripting.FileSystemObject")
-
- Set shell = WScript.CreateObject( "WScript.Shell" )
- sysdrive = shell.ExpandEnvironmentStrings("%SystemDrive%\")
-
- configFolder = "config"
- osinfoFileName = configFolder + "\osinfo.txt"
- adapterinfoFileName = configFolder + "\adapterinfo.txt"
- envinfoFileName = configFolder + "\envinfo.txt"
-
- if Not FSO.FolderExists(configFolder) Then
- FSO.CreateFolder configFolder
- End If
-
- call DumpAllKeys
-
- call GetOSInfo(osinfoFileName)
-
- Set adapterInfoFile = FSO.OpenTextFile(adapterInfoFileName, 2, True)
-
- call GetAdapterInfo(adapterInfoFile)
-
- adapterInfoFile.Close
-
- call GetEnvironmentInfo(envinfoFileName)
-
- Set stylesheet = CreateObject("MSXML2.FreeThreadedDOMDocument.6.0")
- stylesheet.Async = False
- stylesheet.ValidateOnParse = True
- If Not stylesheet.Load(shell.ExpandEnvironmentStrings("%windir%\system32\gatherWiredInfo.xslt")) Then
- Err.Raise stylesheet.ParseError.ErrorCode, "gatherWiredInfo", "gatherWiredInfo.xml line " & stylesheet.ParseError.Line & " column " & stylesheet.ParseError.LinePos & ": " & stylesheet.ParseError.Reason
- End If
- Set template = CreateObject("MSXML2.XSLTemplate.6.0")
- template.Stylesheet = stylesheet
- Set xslProcessor = template.CreateProcessor
-
- onex_tmf = shell.ExpandEnvironmentStrings("%windir%\system32\onex.tmf")
- onex_omit = "ONEX_DEV_REFCOUNTS ONEX_DEV_TRACK UTILS_LIB_TRACK UTILS_LIB_INFO WLAN_UTL_DEV_INFO WLAN_UTL_DEV_TRACK WLAN_UTL_DEV_ERROR WLAN_UTL_DEV_MEMORY Noise Perf Trace"
- dot3_tmf = shell.ExpandEnvironmentStrings("%windir%\system32\dot3.tmf")
- dot3_omit = "ACDLG_DEV_TRACK DEVICE_LAYER_TRACK DOT3_LOG_LEVEL_TRACE DOT3_MSM_REFCOUNTS DOT3_MSM_TRACK UTILS_LIB_TRACK UTILS_LIB_INFO Noise Perf Trace"
- eaphost_tmf = shell.ExpandEnvironmentStrings("%windir%\system32\eaphost.tmf")
- eaphost_omit = "ONEX_DEV_REFCOUNTS ONEX_DEV_TRACK UTILS_LIB_TRACK UTILS_LIB_INFO WLAN_UTL_DEV_INFO WLAN_UTL_DEV_TRACK WLAN_UTL_DEV_ERROR WLAN_UTL_DEV_MEMORY Noise Perf Trace"
- l2nacp_omit = "L2NACP_LOG_LEVEL_TRACE"
-
- FormatTrace "onex", onex_tmf, onex_omit
- FormatTrace "dot3dlg", dot3_tmf, dot3_omit
- FormatTrace "dot3gp", dot3_tmf, dot3_omit
- FormatTrace "dot3msm", dot3_tmf, dot3_omit
- FormatTrace "dot3svc", dot3_tmf, dot3_omit
- FormatTrace "dot3gp", dot3_tmf, dot3_omit
- FormatTrace "eaphost", eaphost_tmf, eaphost_omit
- FormatTrace "l2nacp", onex_tmf, l2nacp_omit
-
- FormatEventLog "WiredAutocfgEventLog"
-