
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get 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
Advertisements