Musashi
05-18-2004, 08:43 AM
Hi peeps,
I have a WMI script collecting data from PC's in our domain. I can't seem to find the right info on how to export all of the info the script picks up to a network share and into a txt file.
I would like each txt file name to be the PC name if poss....Please help!!
Thanks
Here is the script I have written.
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "CountryCode: " & objItem.CountryCode
Wscript.Echo "CSDVersion: " & objItem.CSDVersion
Wscript.Echo "CSName: " & objItem.CSName
Wscript.Echo "SystemDirectory: " & objItem.SystemDirectory
Wscript.Echo "SystemDrive: " & objItem.SystemDrive
Wscript.Echo "TotalVirtualMemorySize: " & objItem.TotalVirtualMemorySize
Wscript.Echo "TotalVisibleMemorySize: " & objItem.TotalVisibleMemorySize
Wscript.Echo "WindowsDirectory: " & objItem.WindowsDirectory
Wscript.Echo "TotalPhysicalMemory: " & objItem.TotalPhysicalMemory
Next
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each objItem in colItems
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "MaxClockSpeed: " & objItem.MaxClockSpeed
Next
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objItem in colItems
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "Capacity: " & objItem.Capacity
Wscript.Echo "DeviceLocator: " & objItem.DeviceLocator
Next
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk",,48)
For Each objItem in colItems
Wscript.Echo "DeviceID: " & objItem.DeviceID
Wscript.Echo "FreeSpace: " & objItem.FreeSpace
Wscript.Echo "Size: " & objItem.Size
Next
Thanks!!
Chris
I have a WMI script collecting data from PC's in our domain. I can't seem to find the right info on how to export all of the info the script picks up to a network share and into a txt file.
I would like each txt file name to be the PC name if poss....Please help!!
Thanks
Here is the script I have written.
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "CountryCode: " & objItem.CountryCode
Wscript.Echo "CSDVersion: " & objItem.CSDVersion
Wscript.Echo "CSName: " & objItem.CSName
Wscript.Echo "SystemDirectory: " & objItem.SystemDirectory
Wscript.Echo "SystemDrive: " & objItem.SystemDrive
Wscript.Echo "TotalVirtualMemorySize: " & objItem.TotalVirtualMemorySize
Wscript.Echo "TotalVisibleMemorySize: " & objItem.TotalVisibleMemorySize
Wscript.Echo "WindowsDirectory: " & objItem.WindowsDirectory
Wscript.Echo "TotalPhysicalMemory: " & objItem.TotalPhysicalMemory
Next
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each objItem in colItems
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "MaxClockSpeed: " & objItem.MaxClockSpeed
Next
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objItem in colItems
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "Capacity: " & objItem.Capacity
Wscript.Echo "DeviceLocator: " & objItem.DeviceLocator
Next
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk",,48)
For Each objItem in colItems
Wscript.Echo "DeviceID: " & objItem.DeviceID
Wscript.Echo "FreeSpace: " & objItem.FreeSpace
Wscript.Echo "Size: " & objItem.Size
Next
Thanks!!
Chris