๐Ÿ”ง Recipe ยท Troubleshooting & Diagnostics

List Network Shares and Mapped Drives on a Windows Workstation with PowerShell

Identify local SMB shares, incoming mapped drives, and their remote sources to troubleshoot unexpected share origins

Complexity

Beginner

Impact

troubleshooting + security-audit + endpoint + windows + smb

Context

Why This Matters

When a user reports a network share that appears unfamiliar โ€” for example a drive letter pointing to an unexpected server, NAS, or IP address โ€” the fastest way to diagnose it is directly on the affected workstation with PowerShell. Windows exposes two distinct concepts that are often confused:

  • Local SMB shares โ€” folders the workstation itself is publishing to the network (enumerated with Get-SmbShare).
  • Mapped network drives โ€” remote shares the workstation has connected to, typically shown as drive letters like Z: (enumerated with Get-SmbMapping, Get-PSDrive, or net use).

This recipe walks through both sides so you can quickly determine whether a suspicious share is hosted on the workstation, mapped from a legitimate file server, or coming from an unexpected host (rogue device, stale GPO mapping, shadow IT NAS, or lateral-movement indicator).

Expected Outcomes

After completing this recipe you will have:

  • A complete list of SMB shares published by the workstation, including hidden administrative shares.
  • A complete list of mapped network drives with their drive letter, remote UNC path, and connection status.
  • The resolved IP address behind any hostname-based mapping, so you can confirm whether the share is coming from your primary file server or an unexpected host.
  • A reusable PowerShell script (Get-WorkstationShareInventory.ps1) that captures all of the above in one pass and can be run locally or against a remote computer via Invoke-Command.

Risks & Considerations

Things to watch out for:

  • User context matters. Mapped drives are per-user. If you run PowerShell as Administrator (elevated), you will not see drives mapped in the standard user session. Run as the affected user, or inspect the user's HKCU:\Network registry hive.
  • Remote execution requires WinRM. Invoke-Command needs PowerShell remoting enabled on the target. RMM-delivered execution is usually simpler in the field.
  • Don't blindly remove unknown shares. Hidden admin shares (C$, ADMIN$, IPC$) are created by Windows and required by many management tools. Deleting them will break backups, RMM, and AD management.
  • A share pointing to an unexpected IP is a potential security signal. If you find a mapping to a host that is not documented (not your file server, not a sanctioned NAS), treat it as a possible indicator of compromise or shadow IT until proven otherwise โ€” capture the output before disconnecting.
  • Legacy OS caveat. Get-SmbShare / Get-SmbMapping require PowerShell 3.0+ and the SmbShare module (Windows 8 / Server 2012 and later). On older systems, fall back to Get-WmiObject Win32_Share and net use.

Required Permissions

PermissionWhy It's Needed
Local user session (for mapped drives)Mapped network drives are stored per-user; must be enumerated in the context of the user who created them.
Local Administrator (optional)Required to enumerate hidden/administrative shares and to run against remote computers via PowerShell remoting.
WinRM / PowerShell Remoting enabledNeeded only if running the inventory against a remote workstation with Invoke-Command instead of locally.

The fastest way to get this done โ€” just ask Dex. Copy the prompt below and paste it into your Dex conversation.

For IT Admins

Paste into Dex CoAdmin

On workstation {computer_name}, list all SMB shares hosted by the device and all mapped network drives for {user}, including the remote UNC path and resolved IP for each mapping. Flag any drive that points to a host other than our primary file server {primary_file_server}.
Try in Dex CoAdmin

For End Users

How an employee would ask Dex for help

One of my drive letters is pointing to a server I don't recognize โ€” can you check where my network drives are actually connected?
Try in Dex Playground