ole, wmi, what the hell did I change?

W

woof

Here's my very first stab at wmi. What did I change? I was trying
to change SystemStartupDelay in Win32_ComputerSystem.Name=WX4
The wmi browser says I changed nothing. If I run this and read
only, it says I did.... change something. I get the "55".
Thanks.

use Win32::OLE;

$wmi = Win32::OLE->GetObject("winmgmts:{impersonationLevel=impersonate,
(security)}//./") || die;

($obj = $wmi->Get("Win32_ComputerSystem")) || die;

# commented out and run again to check for change.
#$obj->{"SystemStartupDelay"} = "55";
#$obj->Put_();

$s = $obj->{"SystemStartupDelay"};
print qq(Is the new value $s\n);
 
I

Ivan Brugiolo [MSFT]

I'm not familiar woth PERL,
but the code below is changing the default value on the class and not the
value on the instance.
Is this expected and intended ?
 
W

woof

I forgot the key value. It should have been
($obj = $wmi->Get("Win32_ComputerSystem.Name='ComputerNameHere'")) || die;
Thanks - I'm a little further now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top