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
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
For Each file in Dot3FileSet
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
cmd = "cmd /c set u >> " & outputFileName
shell.Run cmd, 0, True作者: huanhd 时间: 2010-4-30 12:54 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 GetWcnInfo(outputFileName)
On Error Resume Next
Dim WcnInfoFile
Set WcnInfoFile= FSO.OpenTextFile(outputFileName, 8, True)
WcnInfoFile.WriteLine("-------------------------------------")
WcnInfoFile.WriteLine("---------+ WCN Information +---------")
WcnInfoFile.WriteLine("-------------------------------------")
WcnInfoFile.WriteLine("")
WcnInfoFile.WriteLine("")
WcnInfoFile.WriteLine("-----------------")
WcnInfoFile.WriteLine("+ Services Status")
WcnInfoFile.WriteLine("-----------------")
WcnInfoFile.WriteLine("")
WcnInfoFile.Close
Set objShell = WScript.CreateObject( "WScript.Shell" )
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
WcnInfoFile.WriteLine("")
WcnInfoFile.WriteLine("---------------------")
WcnInfoFile.WriteLine(file)
WcnInfoFile.WriteLine("---------------------")
WcnInfoFile.WriteLine(" - Version : " + objFile.Version )
WcnInfoFile.WriteLine(" - Creation Date : " + objFile.CreationDate )
WcnInfoFile.WriteLine(" - Description : " + objFile.Description )
WcnInfoFile.WriteLine(" - Installation Date : " + objFile.InstallDate )
WcnInfoFile.WriteLine(" - In Use Count : " + objFile.InUseCount )
WcnInfoFile.WriteLine(" - Last Accessed : " + objFile.LastAccessed )
WcnInfoFile.WriteLine(" - Last Modified : " + objFile.LastModified )
WcnInfoFile.WriteLine(" - Status : " + objFile.Status )
Next
Next
WcnInfoFile.WriteLine("")
WcnInfoFile.WriteLine("")
WcnInfoFile.WriteLine("-------------------------------")
WcnInfoFile.WriteLine("+ Network Adapters Information ")
WcnInfoFile.WriteLine("-------------------------------")
WcnInfoFile.WriteLine("")
strQuery = "Select * from Win32_NetworkAdapter "
Set AdapterProp = objWMIService.ExecQuery _
(strQuery)
Select Case objFile.NetConnectionStatus
Case 0 strAvail= "Disconnected"
Case 1 strAvail= "Connecting"
Case 2 strAvail= "Connected"
Case 3 strAvail= "Disconnecting"
Case 4 strAvail= "Hardware not present"
Case 5 strAvail= "Hardware disabled"
Case 6 strAvail= "Hardware malfunction"
Case 7 strAvail= "Media disconnected"
Case 8 strAvail= "Authenticating"
Case 9 strAvail= "Authentication succeeded"
Case 10 strAvail= "Authentication failed"
Case 11 strAvail= "Invalid address"
Case 12 strAvail= "Credentials required"
End Select
Select Case objFile.StatusInfo
Case 1 strAvail= "Other"
Case 2 strAvail= "Unknown"
Case 3 strAvail= "Enabled"
Case 4 strAvail= "Disabled"
Case 5 strAvail= "Not Applicable"
End Select
Select Case objFile.Availability
Case 1 strAvail= "Other"
Case 2 strAvail= "Unknown"
Case 3 strAvail= "Running or Full Power"
Case 4 strAvail= "Warning"
Case 5 strAvail= "In test"
Case 6 strAvail= "Not Applicable"
Case 7 strAvail= "Power Off"
Case 8 strAvail= "Off Line"
Case 9 strAvail= "Off Duty"
Case 10 strAvail= "Degraded"
Case 11 strAvail= "Not Installed"
Case 12 strAvail= "Install Error"
Case 13 strAvail= "Power Save - Unknown"
Case 14 strAvail= "Power Save - Low Power Mode"
Case 15 strAvail= "Power Save - Standby"
Case 16 strAvail= "Power Cycle"
Case 17 strAvail= "Power Save - Warning"
End Select作者: huanhd 时间: 2010-4-30 12:54 WcnInfoFile.WriteLine(" - Availability : " + strAvail )
WcnInfoFile.WriteLine(" - Caption : " + objFile.Caption )
Select Case objFile.ConfigManagerErrorCode
Case 0 strAvail= "Device is working properly"
Case 1 strAvail= "Device is not configured correctly"
Case 2 strAvail= "Windows cannot load the driver for this device"
Case 3 strAvail= "Driver for this device might be corrupted, or the system may be low on memory or other resources"
Case 4 strAvail= "Device is not working properly. One of its drivers or the registry might be corrupted."
Case 5 strAvail= "Driver for the device requires a resource that Windows cannot manage."
Case 6 strAvail= "Boot configuration for the device conflicts with other devices"
Case 7 strAvail= "Cannot filter"
Case 8 strAvail= "Driver loader for the device is missing"
Case 9 strAvail= "Device is not working properly. The controlling firmware is incorrectly reporting the resources for the device"
Case 10 strAvail= "Device cannot start"
Case 11 strAvail= "Device failed"
Case 12 strAvail= "Device cannot find enough free resources to use"
Case 13 strAvail= "Windows cannot verify the device's resources"
Case 14 strAvail= "Device cannot work properly until the computer is restarted"
Case 15 strAvail= "Device is not working properly due to a possible re-enumeration problem"
Case 16 strAvail= "Windows cannot identify all of the resources that the device uses"
Case 17 strAvail= "Device is requesting an unknown resource type."
Case 18 strAvail= "Device drivers must be reinstalled"
Case 19 strAvail= "Failure using the VxD loader"
Case 20 strAvail= "Registry might be corrupted."
Case 21 strAvail= "System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device"
Case 22 strAvail= "Device is disabled"
Case 23 strAvail= "System failure. If changing the device driver is ineffective, see the hardware documentation"
Case 24 strAvail= "Device is not present, not working properly, or does not have all of its drivers installed."
Case 25 strAvail= "Windows is still setting up the device"
Case 27 strAvail= "Device does not have valid log configuration."
Case 28 strAvail= "Device drivers are not installed."
Case 29 strAvail= "Device is disabled. The device firmware did not provide the required resources."
Case 30 strAvail= "Device is using an IRQ resource that another device is using."
Case 31 strAvail= "Device is not working properly. Windows cannot load the required device drivers."
End Select
Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
WcnInfoFile.WriteLine("")
WcnInfoFile.WriteLine("----------------------------------------------")
WcnInfoFile.WriteLine("- Network discovery status for current profile")
WcnInfoFile.WriteLine("----------------------------------------------")
WcnInfoFile.WriteLine("")
Dim rule
' Get the Rules object
Dim RulesObject
Set RulesObject = fwPolicy2.Rules
For Each rule In Rulesobject
if rule.Grouping = "@FirewallAPI.dll,-32752" then
WcnInfoFile.WriteLine("")
WcnInfoFile.WriteLine(" Rule Name: " & rule.Name)
WcnInfoFile.WriteLine(" ----------------------------------------------")
WcnInfoFile.WriteLine(" Enabled: " & rule.Enabled)
WcnInfoFile.WriteLine(" Description: " & rule.Description)
WcnInfoFile.WriteLine(" Application Name: " & rule.ApplicationName)
WcnInfoFile.WriteLine(" Service Name: " & rule.ServiceName)
Select Case rule.Direction
Case NET_FW_RULE_DIR_IN WcnInfoFile.WriteLine(" Direction: In")
Case NET_FW_RULE_DIR_OUT WcnInfoFile.WriteLine(" Direction: Out")
End Select
end if
Next
WcnInfoFile.Close作者: huanhd 时间: 2010-4-30 12:55 End Sub
Sub GetWirelessAdapterInfo(outputFile)
On Error Resume Next
Dim adapters, objReg
Dim adapterDetailNames, adapterDetailRegValNames
For Each adapter In adapterSet
If StrComp("Properties", adapter) Then
fullstrKeyPath = strKeyPath + adapter
objReg.GetDWORDValue HKEY_LOCAL_MACHINE, fullstrKeyPath, "*IfType", ifType
If ifType = 71 Then
for I = 0 to UBound(adapterDetailNames)
objReg.GetStringValue HKEY_LOCAL_MACHINE, fullstrKeyPath, adapterDetailRegValNames(I), info
outputFile.WriteLine(adapterDetailNames(I) + " = " + info)
Next
ihvKeyPath = fullstrKeyPath + "\Ndi\IHVExtensions"
For J = 0 to UBound(IHVDetailNames)
objReg.GetStringValue HKEY_LOCAL_MACHINE, ihvKeyPath, IHVDetailRegValNames(J), ihvInfo
outputFile.WriteLine(IHVDetailNames(J) + " = " + ihvInfo)
Next
objReg.GetDWordValue HKEY_LOCAL_MACHINE, ihvKeyPath, "AdapterOUI", ihvInfo
outputFile.WriteLine("AdapterOUI = " + CSTR(ihvInfo))
outputFile.WriteLine()
End If
End If
Next
Set objShell = WScript.CreateObject( "WScript.Shell" )
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 wlan show all > " & outputFileName
objShell.Run cmd, 0, True
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
' Dump Winsock LSP catalog
Sub DumpWinsockCatalog(outputFileName)
On Error Resume Next
Dim envInfoFile
Set objShell = WScript.CreateObject( "WScript.Shell" )
cmd = "cmd /c netsh winsock show catalog > " & outputFileName
objShell.Run cmd, 0, True
End Sub
' Dump the Windows Firewall Configuration
Sub GetWindowsFirewallInfo(configFileName, logFileName, effectiveRulesFileName, consecLogFileName, logFileNameVerbose, consecLogFileNameVerbose)
On Error Resume Next
Dim envInfoFile
Set objShell = WScript.CreateObject( "WScript.Shell" )