Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Don't ask to ask, just ask
 
PerlMonks  

Re: Win32::OLE and WMI

by Courage (Parson)
on Feb 03, 2004 at 06:33 UTC ( [id://326167]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Win32::OLE and WMI

Okay, given all specualtions that were in this thread here is the code that works and solves your problem:
use Win32::OLE; use Win32::OLE::Variant; $wmiFileSecSetting = Win32::OLE->GetObject("winmgmts:Win32_LogicalFile +SecuritySetting.path='E:\\VK'"); my $wmiSecurityDescriptor = Win32::OLE->GetObject('winmgmts:Win32_Secu +rityDescriptor'); my $v = Variant(VT_DISPATCH|VT_BYREF,$wmiSecurityDescriptor); $RetVal = $wmiFileSecSetting->GetSecurityDescriptor($v); print "$RetVal;[".$v->Get->{Owner}->{Name}."]";
BTW documentation inside Win32::OLE::Variant tells us how to use "byval" in Win32::OLE.

Courage, the Cowardly Dog

Replies are listed 'Best First'.
Re: Re: Win32::OLE and WMI
by grmm2 (Acolyte) on Feb 03, 2004 at 09:00 UTC
    That's great. I wondered if OLE::Variant was implicated in some way, but frankly its documentation could be enhanced for those at intermediate level like me. Now you've pointed that out, I've been able to get the DACL's out which was my main aim all along. Thanks.
    use Win32::OLE; use Win32::OLE::Variant; $wmiFileSecSetting = Win32::OLE->GetObject("winmgmts:Win32_LogicalFile +SecuritySetting.path='D:\\Programming\\test\\a.pl'"); my $wmiSecurityDescriptor = Win32::OLE->GetObject('winmgmts:Win32_Secu +rityDescriptor'); my $v = Variant(VT_DISPATCH|VT_BYREF,$wmiSecurityDescriptor); $RetVal = $wmiFileSecSetting->GetSecurityDescriptor($v); foreach my $ace (@{$v->Value->{DACL}}) { print $ace->{Trustee}->{Domain}.'\\'.$ace->{Trustee}->{Name}.': '. +$ace->{AccessMask}."\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://326167]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.