![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| | #2 (permalink) |
| 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 Specs![]() |
| | #3 (permalink) |
| 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 Specs![]() |
![]() |
| 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 |