- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 list of shared folders using PowerShell?
Get-SmbShare gives all the shared folders on the local system.
PS C:\Temp> Get-SmbShare Name ScopeName Path Description ---- --------- ---- ----------- ADMIN$ * C:\Windows Remote Admin C$ * C:\ Default share DSC * E:\DSC E$ * E:\ Default share IPC$ * Remote IPC Shared1 * E:\Extract
Example
To get the shared folders on the remote computer we can use the CIM session. For example,
$sess = New-CimSession -ComputerName Labmachine2k16 Get-SmbShare -Session $sess
Output
PS C:\Users\Administrator> Get-SmbShare -Session $sess Name ScopeName Path Description PSComputerName ---- --------- ---- ----------- -------------- ADMIN$ * C:\Windows Remote Admin Labmachine2k16 C$ * C:\ Default share Labmachine2k16 DSC * E:\DSC Labmachine2k16 E$ * E:\ Default share Labmachine2k16 IPC$ * Remote IPC Labmachine2k16 Shared1 * E:\Extract Labmachine2k16
- Related Articles
- How to get the list of empty folders using PowerShell?
- How to get hidden files and folders using PowerShell?
- How to get only files but not the folders with Get-ChildItem using PowerShell?
- How to get the Shared folder permissions with PowerShell?
- How to get the list of local groups using PowerShell?
- How to get only hidden files and folders in PowerShell?
- How to Zip / Unzip files or folders using PowerShell?
- How to retrieve files and folders attributes using PowerShell?
- How to change files and folders attributes using PowerShell?
- How to delete empty files and folders using PowerShell?
- How to delete hidden files and folders using PowerShell?
- How to get only folders but not the files in the Get-ChildItem in PowerShell?
- How to list the subfolder contents using Get-ChildItem using PowerShell?
- How to display files/folders including hidden files/folders in PowerShell?
- How to change SMB shared folder access permission using PowerShell?

Advertisements