Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Win32::OLE and WMI

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


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 14: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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-23 22:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found