Thank you for your response. I get the same access denied error whether I use the double blackslashes ("\\") or the single forward slashes ("/") -- running under Windows XP Professional SP1 (with all applied security patches). But when I run this under WSH (windows scripting hosting) as "cscript netmon.pls" as pointed out by Jan Dubois, both styles work.
If you are able to run this as a perl script (perl netmon.pl) then there must be something different about your Windows configuration that allows it to run as "perl" versus a WSH perl script. Any ideas?
Regards,
... Dewey
| Сергей Черниенко
<[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED] 05/12/2006 05:24 AM
|
|
Здравствуйте D,
Thursday, May 11, 2006, 3:23:44 PM, Вы написали:
DDA> I've been trying to write a Perl script that uses the WMI OLE object
DDA> "WbemScripting.SWbemRefresher" to access TCP statistics -- using the WMI
DDA> performance counter class
DDA> "Win32_PerfFormattedData_Tcpip_NetworkInterface".
DDA> I've got it working in _vbscript_ "no issues". But my Perl Win32::OLE
DDA> translation bombs out with an "Access Denied" OLE exception from
DDA> "SWBemRefresher" raised by the "AddEnum" call. I use the same setup code
DDA> in other WMI perl scripts that perform ExeQuery's -- that work.
DDA> _vbscript_ and perl translation follow.
DDA> Anyone have any ideas?
DDA> Regards,
DDA> .. Dewey
Just replace in
Win32::OLE->GetObject('winmgmts:{impersonationLevel=impersonate}!//' .
$strComputer . '/root/cimv2');
all slaches with double backslash. You'll get
Win32::OLE->GetObject('winmgmts:{impersonationLevel=impersonate}!\\\\' .
$strComputer . '\\root\\cimv2');
and script will work. I've got such output:
c:\crow_works>perl netmon.pl
*********
(32) Name: Realtek RTL8139 Family PCI Fast Ethernet NIC
Total Bytes Per Second: 34662
Bytes Sent Per Second: 12233
Bytes Received Per Second: 22428
Packets Per Second: 453
Packets Sent Per Second: 226
Packets Received Per Second: 226
--
С уважением,
Сергей 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
