Forum Discussion
Share & NTFS permissions export
You're going to need to use a combination of https://docs.microsoft.com/en-us/powershell/module/smbshare/get-smbshare?view=windowsserver2019-ps and https://docs.microsoft.com/en-us/powershell/module/smbshare/get-smbshareaccess?view=windowsserver2019-ps
This is also PowerShell version dependent.
$cSession = New-CimSession -ComputerName "server" -Credential (get-credential)
$Results = Get-SmbShare -CimSession $cSession | Get-SmbShareAccess
$cSession | Remove-CimSession
$Results | Export-CSV -Path "<pathToCSVFile>"
if you can help me, I need Share & NTFS permissions for specific folders.
I didn`t understand your script
- Josh977May 20, 2021Copper Contributor
Share permissions are a function of the SMB share which is a separate entity to windows. Even though a folder's properties page has a "sharing tab," all it does is allow you to create SMB entities connected to a particular folder.
Thus you need to use the other CmdLts to access SMB shares.
Get-SMBShare allows you to get all smb shares on a computer.
Get-SMBShareAccess get's you the share permissions for each share.
New-CimSession/Remove-Cimsession is used in case you want to get the data from a remove server.
- dannytveriaMay 23, 2021Brass Contributor
Also when I run my script, I got an error that I attached.
I running the script with Domain Administrator.
ā
- dannytveriaMay 21, 2021Brass ContributorSo how I combine the NTFS & Share permissions to one CSV file?