Microsoft Virtualization Discussions

How to get detailed shares permissions

francesco_giuliano
9,510 Views

Hi all,

I tried to use the Get-NaCifsShareACL cmdlet but I didn't get what I expected. I'd like to have an output with the list of the username and relative ACL for a specific share.

Furthermore I tried to convert the output in a .csv or .html file using the cmdlets ConvertTo-CSV and ConvertTo-HTML with no luck.

Any idea or help?

Thank you

Francesco

3 REPLIES 3

thisisdan
9,431 Views

What did you get and what did you expect?

Provide us with your script or at least your output. 

dlmaldonado
9,431 Views

Have you tried native powershell cmdlets? Can use something like:

get-acl -path "\\path\to\share" | select @{Name='Path'; Expression={split-path $_.Path -noqualifier}}, AccessToString | fl *

MLUNDBERG
9,431 Views

Have you tried using "Get-NaCifsShareAcl | select ShareName -ExpandProperty UserAclInfo"?

Here is an example script using this:

if ($args.length -eq 0)

{

           Write-Host `n"This script use NetApp PowerShell Toolkit to get NetApp cifs share ACL details." `n"Use with a serverlist."

           Write-Host -ForegroundColor Red `n"Ex. .\ListNetAppSharesAcl.ps1 c:\temp\srvlist.txt", `n"Or .\ListNetAppSharesAcl.ps1 c:\temp\srvlist.txt | out-file c:\temp\result.txt"`n

}

else

{

          $computerlist = $args[0]

          "NetappName;Share;User;AccessRights;UnixGroupName"

            foreach ($compname in get-content $computerlist)

          {

                               Connect-NaController $compname | Write-Host

                    if ($errs.Count -eq 0)

                    {

                              $collShares = Get-NaCifsShareAcl | select ShareName -ExpandProperty UserAclInfo

                              if ($errs.Count -eq 0)

                              {

                                        foreach ($Share in $collShares)

                                        {

                                                    $compname+";"+$Share.ShareName+";"+$Share.UserName+";"+$Share.AccessRights+";"+$Share.UnixGroupName

                                        }

                              }

                              else

                              {

                                        $errString = $compname +" -- No result from Get-NaCifsShareAcl"

                                        write-host $errString

                              }

                    }

                    else

                    {

                              $errString = $compname +" -- Cannot connect to NetApp"

                              write-host $errString

                    }

          }

}


Public