Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Win32_Share

Reply
 
Old 05-11-2007   #1 (permalink)
Clint Bodine


 
 

Win32_Share

OK.... this is more of a WMI question than a Powershell question...

I need to verify that a share is available to "Everyone". I was using
gwmi Win32_Share to do the check, but according to MSDN, the results
of the GetAccessMask method "Returns the access rights to the share
held by the user or group on whose behalf the instance is
returned.".

How do I get the Win32_Share instance for "Everyone"?

Thanks


My System SpecsSystem Spec
Old 05-11-2007   #2 (permalink)
Don Jones [MVP]


 
 

Re: Win32_Share

Frustrating, ain't it? Working with permissions via WMI is pretty thankless,
sometimes. FWIW, the only way I was able to do what you're after (not saying
there's not another way, this is just what I found that worked) was to build
a .NET executable that launched a new process under the Everyone well-known
SID, and had THAT process execute the WMI query. But that involved jiggering
the WMI permissions, too, since "Everyone" doesn't have Remote Enable in the
WMI repository, by default.

Win32_Share is pretty much designed so that you can check YOUR permissions
to it, as you note.

FWIW, http://www.codeproject.com/useritems/WIN32_Share.asp might provide
some background information or alternative ideas for you.

--
Don Jones
Windows PowerShell MVP
Founder: www.ScriptingAnswers.com
Co-Author: "Windows PowerShell: TFM"

"Clint Bodine" <csbodine@gmail.com> wrote in message
news:1178902677.073429.30620@p77g2000hsh.googlegroups.com...
> OK.... this is more of a WMI question than a Powershell question...
>
> I need to verify that a share is available to "Everyone". I was using
> gwmi Win32_Share to do the check, but according to MSDN, the results
> of the GetAccessMask method "Returns the access rights to the share
> held by the user or group on whose behalf the instance is
> returned.".
>
> How do I get the Win32_Share instance for "Everyone"?
>
> Thanks
>


My System SpecsSystem Spec
Old 05-11-2007   #3 (permalink)
Clint Bodine


 
 

Re: Win32_Share

Hey Don!

Thanks for the input. After I posted my message, I kept digging deeper
and deeper and this is what I found:

$LSSS = Get-WmiObject -Credential $cred -ComputerName $computer -class
Win32_LogicalShareSecuritySetting -filter "Name = '$sharename'"
if($LSSS) {
$output = "";
$dacl = $LSSS.GetSecurityDescriptor().descriptor.dacl;
$dacl | %{ $output += " User: $($_.Trustee.Name)`tAccessMask: $
($_.AccessMask.toString('x'))`n"; }
write-host $output;
}

I got the idea from here (at the bottom of the page):
http://www.scriptinganswers.com/Arch...ermissions.htm
and just walked through the results until I found the data I was
looking for. $output collects the names of every Trustee that has
some sort of permission to the share.

On May 11, 12:25 pm, "Don Jones [MVP]" <d...@sapien.com> wrote:
> Frustrating, ain't it? Working with permissions via WMI is pretty thankless,
> sometimes. FWIW, the only way I was able to do what you're after (not saying
> there's not another way, this is just what I found that worked) was to build
> a .NET executable that launched a new process under the Everyone well-known
> SID, and had THAT process execute the WMI query. But that involved jiggering
> the WMI permissions, too, since "Everyone" doesn't have Remote Enable in the
> WMI repository, by default.
>
> Win32_Share is pretty much designed so that you can check YOUR permissions
> to it, as you note.
>
> FWIW,http://www.codeproject.com/useritems...Share.aspmight provide
> some background information or alternative ideas for you.
>
> --
> Don Jones
> Windows PowerShell MVP
> Founder:www.ScriptingAnswers.com
> Co-Author: "Windows PowerShell: TFM"
>
> "Clint Bodine" <csbod...@gmail.com> wrote in message
>
> news:1178902677.073429.30620@p77g2000hsh.googlegroups.com...
>
> > OK.... this is more of a WMI question than a Powershell question...

>
> > I need to verify that a share is available to "Everyone". I was using
> > gwmi Win32_Share to do the check, but according to MSDN, the results
> > of the GetAccessMask method "Returns the access rights to the share
> > held by the user or group on whose behalf the instance is
> > returned.".

>
> > How do I get the Win32_Share instance for "Everyone"?

>
> > Thanks



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Subject: get-WMIObject win32_share - reinstall functionality PowerShell
"select Name,Path from Win32_Share" permissions required by ASP.NET to return paths, Vista security
What goes with the WMI Win32_Share class PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46