6

I am attempting to run & debug a Powershell script (which is tailored to run on a remote Windows PC), on MacOS (Monterey M1) through Visual Studio Code.

Mac

Name Value
---- -----
PSVersion 7.2.1
PSEdition Core
GitCommitId 7.2.1
OS Darwin 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.6…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

PC

 Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}       
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

On the Mac, I have installed PSWSMan and following this article https://petri.com/how-to-run-code-remotely-in-visual-studio-code I have attempted to initiate the remote session using:

Enter-PSSession -ComputerName '192.168.1.185' -Credential xxx

The system throws this error right after the password input:

Enter-PSSession: Connecting to remote server 192.168.1.185 failed with the following error message : MI_RESULT_FAILED For more information, see the about_Remote_Troubleshooting Help topic.

which could be due to NTLM incompatibility: https://github.com/dotnet/runtime/issues/887

Anyone successfully running this scenario?

Riccardo
  • 2,054
  • 6
  • 33
  • 51

1 Answers1

0

To resolve the MI_RESULT_FAILED issue, try using the full UPN for the credential.

Our systems are on a domain (my M1-based Mac is not on the domain). Our corporate internal AD domain is formatted like so: DOMAIN.LOCAL (as opposed to domain.com, or our alternate domain emaildomain.com that we use for email and Azure logins). I am able to successfully remote into a Windows-based computer named MYPC01 using the following:

Enter-PSSession -ComputerName MYPC01 -Credential username@domain.local

The screenshot below is of my successful connection to our domain controller from my Mac:

Screenshot of successful PowerShell connection from Mac to PC

Type exit to exit the session and return to your local PS session in your Mac's terminal.


For reference, below is the output from my Mac's PowerShell installation:

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.4
PSEdition                      Core
GitCommitId                    7.3.4
OS                             Darwin 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar  6 21:00:41 PST 2023; root:xnu-8796.101.5~3/…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

NOTE: You must already have WSMan installed, which may require re-installation after updating PowerShell on macOS.

pwsh -Command 'Install-Module -Name PSWSMan'
sudo pwsh -Command 'Install-WSMan'
Emeraldo
  • 13
  • 4