On Error Resume Next
logLocation = WScript.Arguments.Item(0)
Set logFile = CreateObject("Scripting.FileSystemObject")
Set logger = logFile.OpenTextFile(logLocation,2,True)
Set ADSysInfo = CreateObject("ADSystemInfo")
logger.writeline "ComputerName : "&ADSysInfo.ComputerName
logger.writeline "UserName : "&ADSysInfo.UserName
logger.writeline "SiteName : "&ADSysInfo.SiteName
logger.writeline "DomainDNSName : "&ADSysInfo.DomainDNSName
logger.writeline "DomainShortName : "&ADSysInfo.DomainShortName
logger.writeline "ForestDNSName : "&ADSysInfo.ForestDNSName
logger.writeline "IsNativeMode : "&ADSysInfo.IsNativeMode
logger.writeline "PDCRoleOwner : "&ADSysInfo.PDCRoleOwner
logger.writeline "SchemaRoleOwner : "&ADSysInfo.SchemaRoleOwner
For Each var in ADSysInfo.GetTrees
logger.writeline "Tree: " & var
Next
Set objWMIService = GetObject("winmgmts:\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objItem in colItems
logger.writeline "OS : "&objItem.Caption
logger.writeline "ServicePack : "&objItem.ServicePackMajorVersion &"."&objItem.ServicePackMinorVersion
logger.writeline "Build Version : "&objItem.Version
logger.writeline "System Directory: "&objItem.SystemDirectory
logger.writeline "OS Language: "&objItem.OSLanguage
logger.writeline "Current Time Zone: "&objItem.CurrentTimeZone
logger.writeline "CSD Version: "&objItem.CSDVersion
Next
Set Battery = objWMIService.ExecQuery("Select * from win32_battery")
i = 0
For Each objItem in Battery
i = i+1
Next
if i = 0 then
logger.writeline "System : Desktop"
else
logger.writeline "System : NotePad"
end if
Set tcpIp = objWMIService.ExecQuery("Select * from win32_networkadapterconfiguration where ipenabled = true")
For Each objItem in tcpIp
For Each ip in objItem.IPAddress
logger.writeline "IPAddress : "&ip
Next
logger.writeline "MACAddress : "&objItem.MACAddress
For Each gw in objItem.DefaultIPGateWay
logger.writeline "DefaultIPGateWay : "&gw
Next
For Each ds in objItem.DNSServerSearchOrder
logger.writeline "DNSServerSearchOrder : "&ds
Next
logger.writeline "DHCPEnabled : "&objItem.DHCPEnabled
logger.writeline "DHCPLeaseExpires : "&objItem.DHCPLeaseExpires
logger.writeline "DHCPLeaseObtained : "&objItem.DHCPLeaseObtained
logger.writeline "DHCPServer : "&objItem.DHCPServer
For Each ips in objItem.IPSubnet
logger.writeline "IPSubnet : "&ips
Next
Next
if Err Then
logger.writeline Date()&" "&Time()&" "&Err.Number&" "&Err.Description
End if
No comments:
Post a Comment