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.
Why use this workflow
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 withGet-SmbMapping,Get-PSDrive, ornet use).
This workflow walks through both sides so you can 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
- 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 set of PowerShell commands that capture all of the above and can be run locally or against a remote computer via
Invoke-Command.
Risks and considerations
- 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:\Networkregistry hive. - Remote execution requires WinRM.
Invoke-Commandneeds PowerShell remoting enabled on the target. RMM-delivered execution is usually simpler in the field. - Do not 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-SmbShareandGet-SmbMappingrequire PowerShell 3.0+ and theSmbSharemodule (Windows 8 / Server 2012 and later). On older systems, fall back toGet-WmiObject Win32_Shareandnet use.
Required permissions
| Permission | Why 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 enabled | Needed only if running the inventory against a remote workstation with Invoke-Command instead of locally. |
Ask Dex
Paste the prompt into a Dex conversation.
Prompt for IT admins
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}.
How an end user can ask Dex
One of my drive letters is pointing to a server I don't recognize - can you check where my network drives are actually connected?
Manual steps (admin center)
If you prefer a GUI-adjacent path before reaching for a script, you can inspect shares and mapped drives with built-in Windows tooling. Open a PowerShell console on the target workstation (Start, type "PowerShell", run as the affected user) and follow these steps.
Step 1: List SMB shares hosted by the workstation
- In the PowerShell window, run:
Get-SmbShare - Review the Name, Path, and Description columns. Anything whose
Pathstarts with a local drive letter (e.g.C:\Users\Public) is hosted by this workstation. - To include hidden administrative shares, run:
Get-SmbShare -IncludeHidden
Step 2: List mapped network drives (incoming shares)
- Run:
Get-SmbMapping - The LocalPath column shows the drive letter (e.g.
Z:) and RemotePath shows where it points (e.g.\\fileserver01\Financeor\\192.168.1.50\Share). - Cross-check against
net usefor a second view, which also shows persistent flag and status.
Step 3: Verify the share source via GUI
- Open File Explorer (
Win + E) and click This PC. - Right-click the suspicious network drive and choose Properties. The Target or Location field shows the UNC path.
- For shares published by this workstation, open Computer Management > System Tools > Shared Folders > Shares (run
fsmgmt.msc).
Step 4: Resolve hostnames to IPs
- If the
RemotePathuses a server name, confirm the actual host by running:Resolve-DnsName fileserver01 - Compare the returned IP against your documented primary file server. A mismatch needs follow-up.
Microsoft Graph API
Not applicable for this workflow. Enumerating SMB shares and mapped drives is a local Windows operation exposed through WMI/CIM and PowerShell cmdlets. There is no REST/HTTP API surface on a workstation for this. Use the PowerShell approach below, or query WMI remotely via Get-CimInstance -ComputerName if you need a programmatic path.
PowerShell
PowerShell gives you the cleanest, scriptable inventory. The commands below can be run locally on the workstation or wrapped in Invoke-Command -ComputerName <host> for remote execution (requires WinRM).
1. Shares hosted by this workstation
# All active SMB shares, including hidden admin shares
Get-SmbShare -IncludeHidden | Select-Object Name, Path, Description, ShareState | Format-Table -AutoSize2. Mapped drives (incoming connections)
# Drive letter + remote UNC path + status
Get-SmbMapping | Select-Object LocalPath, RemotePath, Status
# Alternative view via PSDrive (shows DisplayRoot for network drives)
Get-PSDrive -PSProvider FileSystem | Where-Object DisplayRoot | Select-Object Name, DisplayRoot
# Classic net use fallback - works on every Windows version
net use3. Resolve remote hostnames to IP addresses
# Pull just the server name out of each RemotePath and resolve it
Get-SmbMapping | ForEach-Object {
$server = ($_.RemotePath -split '\\')[2]
[PSCustomObject]@{
LocalPath = $_.LocalPath
RemotePath = $_.RemotePath
Server = $server
IPAddress = (Resolve-DnsName $server -ErrorAction SilentlyContinue | Where-Object Type -eq 'A' | Select-Object -First 1).IPAddress
}
} | Format-Table -AutoSize4. Per-user mapped drives from the registry
If a user's drives aren't visible in your session, they're still recorded in HKCU:\Network under each drive letter:
Get-ChildItem 'HKCU:\Network' | ForEach-Object {
[PSCustomObject]@{
DriveLetter = $_.PSChildName
RemotePath = (Get-ItemProperty $_.PSPath).RemotePath
}
}Remote execution
Invoke-Command -ComputerName WKSTN-01 -ScriptBlock {
Get-SmbShare -IncludeHidden
Get-SmbMapping
}