J0hn Posted January 5, 2016 Share Posted January 5, 2016 (edited) HiI'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" ) EndIfError Message: Error: The requested action with this object has failed. Edited January 5, 2016 by J0hn Link to comment Share on other sites More sharing options...
Rampantshadow Posted January 6, 2016 Share Posted January 6, 2016 Hi J0hn,I would suggest putting a COM Event catcher, this way if the Event is caught and has something done with it the program will not crash, even if nothing is done in the function the script will not crash.Check out https://www.autoitscript.com/autoit3/docs/functions/ObjEvent.htm for more information.Cheers, Link to comment Share on other sites More sharing options...
J0hn Posted January 6, 2016 Author Share Posted January 6, 2016 Thx, I will have a look. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now