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"; }