J0hn

error in WMI Query, but working?

3 posts in this topic

#1 ·  Posted (edited)

Hi

I've got a piece of code, it works (when ran as administrator is disables the automatic pagefile setting) But the application crashes afterwards.

Can sombody point me in a direction what I'm doing wrong?

 

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""

$oWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\ROOT\CIMV2")
$colItems = $oWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL")

If IsObj($colItems) Then
   For $objItem In $colItems
        $objItem.AutomaticManagedPagefile = False
        $objItem.Put_()
   Next
Else
   MsgBox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystem" )
EndIf

Error Message: Error: The requested action with this object has failed.

Edited by J0hn

Share this post


Link to post
Share on other sites



Thx, I will have a look.

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