If you're confused twice, I'm confused three times.

I updated the default impersonation setting in "Component Services -> Computers -> My Computer" as you suggested.  Never having looked at this before, I thought that it shouldn't work because the default setting should be overriden by the "{impersonationLevel=Impersonate}!" security setting in the GetObject call that "gets" the WMIService object.  Isn't that what it's supposed to do?

my $objWMIService = Win32::OLE->GetObject('winmgmts:{impersonationLevel=Impersonate}!//' . $strComputer . '/root/cimv2');

So I applied the change -- and then reran the perl script.  No change.  Still bombed with an "Access Denied" message.  I went back into Administrative Tools -> Component Services to confirm that I saved the change -- and it was there (default level set to Impersonate).  Tried running it again with the same "Access Denied" problem.

After lunch, I decided to reboot and then try it again.  Surprise, it worked!


While I'm glad it worked, I'm still left with the question of why it worked?  That it did work brings into question whether the "{impersonationLevel=Impersonate}!" clause actually changes the default setting.  Apparently, when running under WSH, it does.  But not under normal Win32 perl execution.    And this means that I can't readily distribute this script to others to run... because they would also have to change the default impersonation setting.

Thank you very much for you insight and knowledge.

Regards,

... Dewey





Сергей Черниенко <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]

05/12/2006 08:30 AM

Please respond to
Сергей Черниенко <[EMAIL PROTECTED]>

To
[email protected]
cc
Subject
Re: "WbemScripting.SWbemRefresher" _vbscript_ -> Perl





Здравствуйте D,

Friday, May 12, 2006, 2:41:12 PM, Вы написали:

DDA> Thank you for your response.   I get the same access denied error whether
DDA> I use the double blackslashes ("\\") or the single forward slashes ("/")
DDA> -- running under Windows XP Professional SP1 (with all applied security
DDA> patches).   But when I run this under WSH (windows scripting hosting)  as
DDA> "cscript netmon.pls" as pointed out by Jan Dubois, both styles work.

DDA> If you are able to run this as a perl script (perl netmon.pl) then there
DDA> must be something different about your Windows configuration that allows
DDA> it to run as "perl" versus a WSH perl script.  Any ideas?

DDA> Regards,

DDA> ... Dewey


    Yes, I was wrong. No matter either I use slashes or backslashes.
    At first I decided it's security issue and made search in various
    settings Changing them one by one and run the script. But nothing
    good happened. I was confused and have tried those backslashes and
    script start to work! I decided erroneously that backslashes is
    the solution. But after Dewey's answer I change backslashes back
    to slashes but script continues to work! Confused twice!

    Well, it really is security issue. To avoid "Access denied"
    message it is necessary run Component Services console from
    Administrative Tools, right-click on Component
    Services\Computers\My Computer, click on Properties in context
    menu and on Default Properties tab set Default impersonation
    level in "impersonate". After that script works for me (Windows
    2003 server, member of Administartors group (I mean user)).

--
С уважением,
Сергей                            mailto:[EMAIL PROTECTED]


_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to