Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Win32_Share

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 05-11-2007   #1 (permalink)
Clint Bodine
Guest


 

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]
Guest


 

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
Guest


 

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
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
"select Name,Path from Win32_Share" permissions required by ASP.NET to return paths, developers2008 Vista security 0 09-01-2008 09:33 PM
What goes with the WMI Win32_Share class Bob Landau PowerShell 2 12-21-2007 01:33 PM


Vistax64.com 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 2005-2008

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 47 48 49 50 51