SMB Sessions

Manage SMB sessions on a Windows machine using the net use command.

Tip

If there is a connection from one machine to another with a given user account, you cannot open another SMB session to that same target machine as a different user. See how to drop a session to sidestep this problem.

Display your current sessions (requires admin):

net sessions

Set up a session with a target:

net use \\[targetIP] [password] /u:[user]

Tip

If you don’t provide a password, it will prompt you for one.

Alternatively, you can setup a session within a single command prompt:

runas /netonly /user:[user] cmd.exe

Drop a session with a target:

net use \\[targetIP] /del

Or use * instead of \\[targetIP] to drop all sessions for your current user.

net use * /del /y

Mount a share on a target:

net use * \\[targetIP]\[share] [password] /u:[user]

If you don’t provide a password, it will prompt you for one.

Tip

Some versions of Windows require specifying the machine name before the user: \u:[MachineName_or_Domain]\[user]