question

Marcus-9726 avatar image
0 Votes"
Marcus-9726 asked Marcus-9726 commented

Export File Share Permissions to CSV

Hi,

I have came across several articles from microsoft or internet but all of them are script that help to export the NTFS permissions of shared folder. I would like to export out the Share permissions of those shared folder instead of NTFS permission to CSV file. I know that I could export out the registry key for shared folders but is there any commands or script that could export it out to csv file?

Thank you.

windows-serverwindows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered Marcus-9726 commented

Hi,

You can use the Get-Smbshare cmdlet to get the security descriptor of the share.

 $share = "myshare"
 $file = "C:\temp\share.csv"
 Get-SmbShare -Name $share | Select-Object -Property Name,SecurityDescriptor | Export-csv -NoTypeInformation -Path $file

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Ian Xue,

Thanks for providing the script. Can I export all file shares permission at once instead of typing each shared folder name into the $share variable?

0 Votes 0 ·

You just need to remove the "Name" parameter.

 $file = "C:\temp\share.csv"
 Get-SmbShare | Select-Object -Property Name,SecurityDescriptor | Export-csv -NoTypeInformation -Path $file




0 Votes 0 ·

Hi Ian Xue,

Thanks for the answer, let me try with the script and update you the result.

0 Votes 0 ·
Show more comments