Re: monad : enumerate shares with permissions ?



np,
if you have questions just ask, I did this script quick at work, so it's very basic but I hope it gets you going.

you can find some more info about ACL's on my blog
http://mow001.blogspot.com , try a search for ACL, you will find some more examples and links to MSH for fun, that has also some good ACL info.

also, you can find info about share permissions with WMI on my blog : http://mow001.blogspot.com/2005/11/replace-security-on-existing-share.html

I only did file ACL's local , as you need it remote you need to do it with WMI, but you can go on from the win32_share sample.

the example shows how to get from share to directory rights.
also the .NET class used to translate the accessmask (the long enum, you can use WMI as in the share example)

for more info about the WMI classes and methods you can look at the WMI help series. the update of the script from part 3 could be handy.

http://mow001.blogspot.com/2006/03/msh-get-wmimethodhelp-function-update.html

or you might find it handy to use popd

as it is remote it makes it less trival
but I hope this helps,

gr /\/\o\/\/

jmd.msdn wrote:
Thank you.
I will analyze and try to understand !
It does not seem simple.

"/\/\o\/\/ [MVP]" <oMVP@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:A6783BBB-FC1A-4A90-8294-309B021F8B22@xxxxxxxxxxxxxxxx
the basics :

$computer = 'computer'

get-wmiobject win32_share -computer $computer | foreach {
"Share :"
$_ | select name,

@{e={trap{continue};[enum]::parse([System.Security.AccessControl.FileSystemRights],($_.accessmask))};n='access'},path | fl
"Dir :"
get-wmiobject win32_directory -computer $computer -filter "name =
'$($_.path.replace('\','\\'))'" | select name,

@{e={trap{continue};[enum]::parse([System.Security.AccessControl.FileSystemRights],($_.accessmask))};n='access'} | fl
}

hope this helps

gr /\/\o\/\/



"jmd.msdn" wrote:

Hello.
Is it possible, in Monad, to enumerate shares, shares permissions and ntfs
permissions on the shares trees on a remote server ?
Thank you in advance.

jmd





.



Relevant Pages

  • Re: Create simple file share on the fly
    ... WMI share routine faithfully works. ... You can place the command line below as the final line in your WMI ... You might experiment with actual workstations to see if the script is ... the shares that I make from the Windows GUI, ...
    (microsoft.public.windowsxp.security_admin)
  • Re: script error
    ... WMI services is up and running. ... If I run the script locally, ... After research I found the following regarding connecting to remote ... W2k3 can only connect to Win9x and NT if credentials supplied. ...
    (microsoft.public.scripting.vbscript)
  • Re: Who logs in to that pc
    ... > I have not tested this myself remote but here is the code to use WMI ... Can somebody help me with vb script codes on this matter? ... >> to be run at the local host. ...
    (microsoft.public.scripting.vbscript)
  • Re: VBScript - Remote Registry
    ... I know it is possible to connect the registry on a remote computer via WMI. ... What I want to do is to create a "run as" option inside my script. ... I know it is possible to connect a remote WMI service with alternate credentials, and I know that the "stdregprov" class is under "root\default". ...
    (microsoft.public.windows.server.scripting)
  • Re: script error
    ... WMI services is up and running. ... If I run the script locally, ... After research I found the following regarding connecting to remote ... I cannot set firewall as said on above "netsh firewall set service ...
    (microsoft.public.scripting.vbscript)

Loading