Discussion:
Compilling or I am very new, pls Help
(too old to reply)
Luciano
2009-05-05 16:44:02 UTC
Permalink
Hi,

I have a couple of WMI Script and I would like to use all together in one
Script!? Is this possible? And how?
Also I would like to show the Information in a Webpage, some Ideas!?
For example:
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where Index = 1 ")

For Each objItem in colItems
Wscript.Echo "MAC Address: " & objItem.MACAddress
For Each strAddress in objItem.IPAddress
Wscript.Echo "IP-Address: " & strAddress
For Each strIPSubnet in objItem.IPSubnet
Wscript.Echo "IP Subnet: " & strIPSubnet
For Each strGateway in objItem.DefaultIPGateway
Wscript.Echo "Gateway: " & strGateway
For Each strDNS in objItem.DNSServerSearchOrder
Wscript.Echo "DNS IP-Address: " & strDNS
Next
Next
Next
Next
Next

-With-
'Get strComputer from each line of text file.
strComputer = "."
Set objWMIService = GetObject("winmgmts://" & strComputer)
Set colOSes = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem" & "SELECT * FROM Win32_LogicalDisk")
For Each objOS in colOSes
Wscript.Echo
Wscript.Echo strComputer
Wscript.Echo "Name: " & objOS.Name
Wscript.Echo "OS Version: " & objOS.Version
Wscript.Echo "Service Pack: " & objOS.ServicePackMajorVersion & _
"." & objOS.ServicePackMinorVersion
Wscript.Echo "System Drive: " & objOS.SystemDrive

Set objSWbemServices = GetObject("winmgmts:")
Set objDisk = objSWbemServices.Get("Win32_LogicalDisk.DeviceID='C:'")
Wscript.Echo "Free Space: " & objDisk.FreeSpace
Next

Please I need your help, thank you
mayayana
2009-05-06 02:36:54 UTC
Permalink
Your question is very general. If it were me I would
write a VBScript class that contains functions to return
the various sets of data you need. Then I'd load that
class in an HTA where the data can be formatted.
For that you'll need to know CSS, HTML, VBScript,
and the IE DOM. But if you have some familiarity with
those things it's an easy job. However, if you want
specific help then you will need to ask specific questions.
Post by Luciano
I have a couple of WMI Script and I would like to use all together in one
Script!? Is this possible? And how?
Also I would like to show the Information in a Webpage, some Ideas!?
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where Index = 1 ")
For Each objItem in colItems
Wscript.Echo "MAC Address: " & objItem.MACAddress
For Each strAddress in objItem.IPAddress
Wscript.Echo "IP-Address: " & strAddress
For Each strIPSubnet in objItem.IPSubnet
Wscript.Echo "IP Subnet: " & strIPSubnet
For Each strGateway in objItem.DefaultIPGateway
Wscript.Echo "Gateway: " & strGateway
For Each strDNS in objItem.DNSServerSearchOrder
Wscript.Echo "DNS IP-Address: " & strDNS
Next
Next
Next
Next
Next
-With-
'Get strComputer from each line of text file.
strComputer = "."
Set objWMIService = GetObject("winmgmts://" & strComputer)
Set colOSes = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem" & "SELECT * FROM
Win32_LogicalDisk")
Post by Luciano
For Each objOS in colOSes
Wscript.Echo
Wscript.Echo strComputer
Wscript.Echo "Name: " & objOS.Name
Wscript.Echo "OS Version: " & objOS.Version
Wscript.Echo "Service Pack: " & objOS.ServicePackMajorVersion & _
"." & objOS.ServicePackMinorVersion
Wscript.Echo "System Drive: " & objOS.SystemDrive
Set objSWbemServices = GetObject("winmgmts:")
Set objDisk = objSWbemServices.Get("Win32_LogicalDisk.DeviceID='C:'")
Wscript.Echo "Free Space: " & objDisk.FreeSpace
Next
Please I need your help, thank you
Luciano
2009-05-06 15:12:04 UTC
Permalink
Hi,
I am not sure in what I should do, I am very new in this materia.
So how can I call a wmi script from vbscript or more then one!?
I want to call diferents wmi scripts and save into a file and later put in
on a webpage
Any Ideas!?
Post by mayayana
Your question is very general. If it were me I would
write a VBScript class that contains functions to return
the various sets of data you need. Then I'd load that
class in an HTA where the data can be formatted.
For that you'll need to know CSS, HTML, VBScript,
and the IE DOM. But if you have some familiarity with
those things it's an easy job. However, if you want
specific help then you will need to ask specific questions.
Post by Luciano
I have a couple of WMI Script and I would like to use all together in one
Script!? Is this possible? And how?
Also I would like to show the Information in a Webpage, some Ideas!?
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where Index = 1 ")
For Each objItem in colItems
Wscript.Echo "MAC Address: " & objItem.MACAddress
For Each strAddress in objItem.IPAddress
Wscript.Echo "IP-Address: " & strAddress
For Each strIPSubnet in objItem.IPSubnet
Wscript.Echo "IP Subnet: " & strIPSubnet
For Each strGateway in objItem.DefaultIPGateway
Wscript.Echo "Gateway: " & strGateway
For Each strDNS in objItem.DNSServerSearchOrder
Wscript.Echo "DNS IP-Address: " & strDNS
Next
Next
Next
Next
Next
-With-
'Get strComputer from each line of text file.
strComputer = "."
Set objWMIService = GetObject("winmgmts://" & strComputer)
Set colOSes = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem" & "SELECT * FROM
Win32_LogicalDisk")
Post by Luciano
For Each objOS in colOSes
Wscript.Echo
Wscript.Echo strComputer
Wscript.Echo "Name: " & objOS.Name
Wscript.Echo "OS Version: " & objOS.Version
Wscript.Echo "Service Pack: " & objOS.ServicePackMajorVersion & _
"." & objOS.ServicePackMinorVersion
Wscript.Echo "System Drive: " & objOS.SystemDrive
Set objSWbemServices = GetObject("winmgmts:")
Set objDisk = objSWbemServices.Get("Win32_LogicalDisk.DeviceID='C:'")
Wscript.Echo "Free Space: " & objDisk.FreeSpace
Next
Please I need your help, thank you
Loading...