Jump to content
Sign in to follow this  
Wenadude

WMI Script on XP embedded

Recommended Posts

Wenadude

HI

I am trying to run the below script on WINXP embedded but it fails.ERROR = Variable must be of type "Object".:

It works on all Normal XP machines.

Seams to be failing at : $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\")

$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_SystemOperatingSystem","WQL", _

$wbemFlagReturnImmediately + $wbemFlagForwardOnly)

Please assist

Thanks

Alistair

_______________________________________________________________________________________________________________________

$wbemFlagReturnImmediately = 0x10

$wbemFlagForwardOnly = 0x20

$colItems = ""

$strComputer = "."

$Output=""

$Output = $Output & "Computer: " & $strComputer & @CRLF

$Output = $Output & "==========================================" & @CRLF

$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")

$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_SystemOperatingSystem","WQL", _

$wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then

For $objItem In $colItems

$Output = $Output & "GroupComponent: " & $objItem.GroupComponent & @CRLF

$Output = $Output & "PartComponent: " & $objItem.PartComponent & @CRLF

$Output = $Output & "PrimaryOS: " & $objItem.PrimaryOS & @CRLF

if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop

$Output=""

Next

Else

Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_SystemOperatingSystem" )

Endif

________________________________________________________________________________________________________________________

Share this post


Link to post
Share on other sites
Tripredacus

Are you using WES?

Anyways, some ideas. First declare $colItems global. It seems you have no declarations either. Also get rid of the

$colItems = ""

Because it should be blank at that part of script executing, unless you are using this var previously. Also try using

$sWMIService = "winmgmts:\\" & @ComputerName & "\root\CIMV2"
$objWMIService = ObjGet($sWMIService)

Instead of setting $strComputer to "." Also try your SELECT without the $wbemFlagReturnImmediately + $wbemFlagForwardOnly conditions. Do you need these conditions? I've never used them so I'm not sure what they are for.

Also in your IF statement that has the MsgBox, you have no EndIf. Next time post your code using the [ autoit] tags like I did. Makes it easier to read.

Share this post


Link to post
Share on other sites
Wenadude

Hi

Noted:Will add script correctly next time.

I am using WePos XP.

The above scipt was generated by Script-O-Matic and works perfectly on Windows XP Pro.

Thanks Alistair

Share this post


Link to post
Share on other sites
Tripredacus

I just check my documentation but there isn't really anything that compares those internal features (such as the WMI Namespace) between the different XPe versions. You can try out the X15-17821 POS Support Tools to see if there is something applicable in there. I do not have an XP system to install those tools on.

Also I checked what I've got and I do not have the older versions of WEPOS, only POSReady 2009, so I can't actually test it out myself. You can try running the WMI Tools on it and see if those fields are even there. Otherwise, you should contact your Embedded Partner for support on this issue.

Share this post


Link to post
Share on other sites
Wenadude

Hi All

I have resolved this.

It was a case of asking someone to do something for me when I should have done it myself.

I know that WMI does not work on SP1 and when I asked our POS consultant what SP he is running he told me SP2.............

Thanks to all that replied.

Could some one assist me in how to close this message...

Alistair

Share this post


Link to post
Share on other sites
Tripredacus

Hi All

I have resolved this.

It was a case of asking someone to do something for me when I should have done it myself.

I know that WMI does not work on SP1 and when I asked our POS consultant what SP he is running he told me SP2.............

Thanks to all that replied.

Could some one assist me in how to close this message...

Alistair

I don't think it needs to be closed. I was going to see if you were up to date, since I saw on Connect that there were updates to WEPOS as of May 2011.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×