- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the Shared folder permissions with PowerShell?
To get the shared folder permissions using PowerShell, we can use the Get-SmbShare cmdlet.
For example, we have a shared folder name DSC and we need to retrieve its permissions, we can use the below command.
Command
Get-SmbShare -Name DSC
Output
Name ScopeName Path Description ---- --------- ---- ----------- DSC * E:\DSC
It doesn’t show the permission by default and we can retrieve the full list using Fl *. For example,
Get-SmbShare -Name DSC | fl *
And you can see the PresentPathACL property there. This property is used to retrieve the permissions on the shared folder. So we can directly use the command,
Command
(Get-SmbShare -Name DSC).PresetPathAcl
Output
Directory: E:\ Path Owner Access ---- ----- ------ DSC BUILTIN\Administrators Everyone Allow ReadAndExecute, Synchronize
To get the shared folder permission from the remote computer use,
Invoke-Command -ComputerName Labmachine2k16 -ScriptBlock { Get-SmbShare -Name DSC} | Select -ExpandProperty PresetPathAcl
Another direct command, you can use is Get-SmbShareAccess
Command
Get-SmbShareAccess -Name "Shared folder"
Output
PS C:\Temp> Get-SmbShareAccess -Name "Shared folder" Name ScopeName AccountName AccessControlType AccessRight ---- --------- ----------- ----------------- ----------- Shared folder * Everyone Allow Read
- Related Articles
- How to change SMB shared folder access permission using PowerShell?
- How to get the folder size using PowerShell?
- How to get the list of shared folders using PowerShell?
- How to view folder NTFS permission with PowerShell?
- How to Copy NTFS permissions using PowerShell?
- How to copy folder contents in PowerShell with –Recurse parameter?
- How to share a windows folder using PowerShell?
- How to remove windows folder sharing using PowerShell?
- How to get the System uptime with PowerShell?
- How to test the shared location path from the remote computer in PowerShell?
- How to get services on remote computers with PowerShell?
- How to get the services on a local computer with PowerShell?
- How to get service information with the WMI method using PowerShell?
- How to get only files but not the folders with Get-ChildItem using PowerShell?
- How to get the running processes with the WMI object using PowerShell?

Advertisements