ole, wmi, what the hell did I change?

Discussion in 'Perl Misc' started by woof, Nov 8, 2003.

  1. woof

    woof Guest

    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);
     
    woof, Nov 8, 2003
    #1
    1. Advertising

  2. 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 ?

    --
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of any included script samples are subject to the terms specified at
    http://www.microsoft.com/info/cpyright.htm


    "woof" <> wrote in message
    news:...
    > 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);
     
    Ivan Brugiolo [MSFT], Nov 8, 2003
    #2
    1. Advertising

  3. woof

    woof Guest

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


    "Ivan Brugiolo [MSFT]" <> wrote in message news:<#>...
    > 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 ?
    >
    > --
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    > Use of any included script samples are subject to the terms specified at
    > http://www.microsoft.com/info/cpyright.htm
    >
    >
    > "woof" <> wrote in message
    > news:...
    > > 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);
     
    woof, Nov 9, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick.O.Ige

    Ole ole

    Patrick.O.Ige, Jul 16, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    524
    Patrick.O.Ige
    Jul 16, 2006
  2. Drew Pihera
    Replies:
    0
    Views:
    666
    Drew Pihera
    Feb 4, 2004
  3. Lance Hoffmeyer
    Replies:
    0
    Views:
    273
    Lance Hoffmeyer
    Nov 17, 2003
  4. Daniel Berger

    Win32::OLE, WMI and executing methods

    Daniel Berger, Jun 3, 2004, in forum: Perl Misc
    Replies:
    3
    Views:
    540
    Daniel Berger
    Jun 4, 2004
  5. Daniel Berger

    OLE, WMI and ExecMethod - possible?

    Daniel Berger, Jun 15, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    297
    Petri
    Jun 15, 2004
Loading...

Share This Page