Microsoft Virtualization Discussions

How to get detailed shares permissions

francesco_giuliano

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

MLUNDBERG

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

                    }

          }

}


dlmaldonado

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 *

thisisdan

What did you get and what did you expect?

Provide us with your script or at least your output. 

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public