Kali Linux通过PowerShell远程连Windows报错MI_RESULT_ACCESS_DENIED求助
MI_RESULT_ACCESS_DENIED with PowerShell Remoting from Kali Linux Hey there, let's break down what's going on here and fix that access denied error. First off: Linux-based PowerShell Core does support remoting to Windows hosts—your issue is almost certainly missing configuration steps on the Windows side, plus the fact you're using a very early alpha version of PS Core which has known compatibility bugs.
1. First, Configure the Windows Target Host
To accept PowerShell remote sessions, your Windows machine needs these critical setup steps (run all in an elevated Windows PowerShell window):
- Enable PowerShell remoting and WinRM:
This command auto-configures WinRM, sets up firewall rules for remote management, and enables session support.Enable-PSRemoting -Force - Add your Kali host to WinRM's trusted list:
Windows blocks remoting from untrusted hosts by default. Add your Kali machine's IP or hostname with:
(To add multiple hosts, separate them with commas.)Set-Item WSMan:\localhost\Client\TrustedHosts -Value "your-kali-ip-or-hostname" -Force - Verify your user has permissions:
The account in$credmust be a member of the Windows local Administrators group (or have been explicitly granted remote management rights via Group Policy). Standard user accounts don't get this access by default.
2. Upgrade Your Outdated PowerShell Core Version
You're running v6.0.0-alpha.18—this is an extremely early, unstable test build of PowerShell Core with tons of known bugs, including issues with WinRM remoting. Upgrading to the latest stable PowerShell 7.x release will fix most compatibility problems.
On Kali, do this to upgrade:
- Uninstall the old alpha version:
sudo apt remove powershell -y - Add Microsoft's official repository and install the latest stable build:
# Adjust the Debian version to match your Kali release (e.g., Debian 12 for Kali 2023+) curl https://packages.microsoft.com/config/debian/11/prod.list | sudo tee /etc/apt/sources.list.d/microsoft-prod.list sudo apt update sudo apt install powershell -y
3. Additional Connection Checks
- Verify port connectivity: WinRM uses port 5985 (HTTP) or 5986 (HTTPS) by default. Test if Kali can reach this port on Windows with:
nc -zv Host1 5985 - Bypass UAC remote restrictions (if needed):
If Windows' UAC blocks remote admin access, add the-EnableNetworkAccessparameter to your session command:New-PSSession -ComputerName Host1 -Credential $cred -EnableNetworkAccess
4. Common Causes of MI_RESULT_ACCESS_DENIED Recap
- PSRemoting/WinRM isn't enabled on the Windows host
- The user in
$credlacks administrative/remote management permissions - Your Kali host isn't in Windows' WinRM trusted hosts list
- Outdated PowerShell Core alpha version with compatibility bugs
- Firewall (Windows or Kali) is blocking WinRM ports
Walk through these steps one by one, and you should get that remote session working.
内容的提问来源于stack exchange,提问作者Robert

