N
NorthWood
Hi all,
I'm not a Vbscript/WMI programmer so my question will sounds a
little stupid but at the moment I'm creating an unattended setup
installation of Windows so I adapted the following script, which it's
clearly wrong somewhere, it's purpose should be to discriminate between
two kinds of hardware (desktop or laptops) and to achieve this I
thought that Win32_Battery or Win32_PortableBattery method is the key,
unfortunately I don't know how to use it correctly, could someone
please advice? Thanks
CODE
------------------------------------------------------------
'Option Explicit
Dim ObjItem
Dim strComputer
Dim objWMIService
Set WshShell = WScript.CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Battery")
For Each objItem in colItems
If objItem.Availability <> "" THEN
WshShell.Run "%systemdrive%\install\laptop.cmd "
else
WshShell.RUn "%systemdrive%\install\desktop.cmd "
End If
Next
------------------------------------------------------
I'm not a Vbscript/WMI programmer so my question will sounds a
little stupid but at the moment I'm creating an unattended setup
installation of Windows so I adapted the following script, which it's
clearly wrong somewhere, it's purpose should be to discriminate between
two kinds of hardware (desktop or laptops) and to achieve this I
thought that Win32_Battery or Win32_PortableBattery method is the key,
unfortunately I don't know how to use it correctly, could someone
please advice? Thanks
CODE
------------------------------------------------------------
'Option Explicit
Dim ObjItem
Dim strComputer
Dim objWMIService
Set WshShell = WScript.CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Battery")
For Each objItem in colItems
If objItem.Availability <> "" THEN
WshShell.Run "%systemdrive%\install\laptop.cmd "
else
WshShell.RUn "%systemdrive%\install\desktop.cmd "
End If
Next
------------------------------------------------------