Shares

Enumerate

Command
Description

net share

Lists or creates shares on the local computer.

net use

Displays connected network shares.

net share

Lists all shared resources on the local computer.

Get-SmbShare

PowerShell cmdlet to list SMB shares.

fsmgmt.msc

Opens the Shared Folders Management Console (GUI).

Get-WmiObject Win32_Share

Retrieves shared resources using WMI in PowerShell.

Get-SmbShareAccess

Retrieves access permissions for an SMB share in PowerShell.

net session

Lists or disconnects sessions between the computer and others.

net file

Lists or closes open files shared on the computer.

Create/Connect

Command
Description

net share [NetShareName]=[Drive\\Share]

Create a network share

net share <sharename>=<drive>:<path>

Map share from remote host

net share <sharename> /delete

Delete network share

net share progfiles="C:\\Program Files"

Share Program Files directly as progfiles

net use

Connects, disconnects, and lists network connections.

net use Z:\\10.50.50.52\classrom

Connect to a share

New-SmbShare

Creates a new SMB share in PowerShell.

Remove-SmbShare

Removes an SMB share in PowerShell.

Set-SmbShare

Modifies settings of an SMB share in PowerShell.

Grant-SmbShareAccess

Grants access permissions to an SMB share in PowerShell.

Revoke-SmbShareAccess

Revokes access permissions from an SMB share in PowerShell.

net session

Lists or disconnects sessions between the computer and others.

net session /list

Lists shares

net session \\ComputerName /delete

Deletes connections remotely

net file

Lists open files shared on the computer. Shows File IDs.

net file <FileID> /close

Close the specified file that is open on the network.

Registry Locations

SMB Shares:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Shares

This key contains information about each shared folder on the system, including the share name, path, type, and permissions.

SMB Server Configuration:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

This key holds various settings related to the SMB (Server Message Block) protocol and file sharing, such as security settings, maximum number of users, and other operational parameters.

SMB Client Configuration:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters

This key includes settings for the SMB client, controlling how the system accesses shared resources on other computers.

Last updated

Was this helpful?