Ric*_*rdo 6 windows macos powershell ntlm visual-studio-code
我正在尝试通过 Visual Studio Code 在 MacOS (Monterey M1) 上运行和调试 Powershell 脚本(专为在远程 Windows PC 上运行而定制)。
\n苹果
\nName Value\n---- -----\nPSVersion 7.2.1\nPSEdition Core\nGitCommitId 7.2.1\nOS Darwin 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.6\xe2\x80\xa6\nPlatform Unix\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0\xe2\x80\xa6}\nPSRemotingProtocolVersion 2.3\nSerializationVersion 1.1.0.1\nWSManStackVersion 3.0\n
Run Code Online (Sandbox Code Playgroud)\n个人电脑
\n Name Value\n---- -----\nPSVersion 7.2.1\nPSEdition Core\nGitCommitId 7.2.1\nOS Microsoft Windows 10.0.19043\nPlatform Win32NT\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0\xe2\x80\xa6} \nPSRemotingProtocolVersion 2.3\nSerializationVersion 1.1.0.1\nWSManStackVersion 3.0\n
Run Code Online (Sandbox Code Playgroud)\n在 Mac 上,我已经安装PSWSMan
并遵循这篇文章https://petri.com/how-to-run-code-remotely-in-visual-studio-code我尝试使用以下命令启动远程会话:
Enter-PSSession -ComputerName \'192.168.1.185\' -Credential xxx\n
Run Code Online (Sandbox Code Playgroud)\n输入密码后系统立即抛出此错误:
\nEnter-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.\n
Run Code Online (Sandbox Code Playgroud)\n这可能是由于 NTLM 不兼容造成的:https://github.com/dotnet/runtime/issues/887
\n有人成功运行这个场景吗?
\n要解决 MI_RESULT_FAILED 问题,请尝试使用凭据的完整 UPN。
\n我们的系统位于域中(我的基于 M1 的 Mac 不在域中)。我们公司内部 AD 域的格式如下:(DOMAIN.LOCAL
与 domain.com 或我们用于电子邮件和 Azure 登录的备用域 emaildomain.com 相反)。我能够使用以下命令成功远程访问名为 MYPC01 的基于 Windows 的计算机:
Enter-PSSession -ComputerName MYPC01 -Credential username@domain.local\n
Run Code Online (Sandbox Code Playgroud)\n下面的屏幕截图是我从 Mac 成功连接到域控制器的情况:
\n\n键入exit
退出会话并返回到 Mac 终端中的本地 PS 会话。
作为参考,下面是我的 Mac PowerShell 安装的输出:
\n$PSVersionTable\n\nName Value\n---- -----\nPSVersion 7.3.4\nPSEdition Core\nGitCommitId 7.3.4\nOS Darwin 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:41 PST 2023; root:xnu-8796.101.5~3/\xe2\x80\xa6\nPlatform Unix\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0\xe2\x80\xa6}\nPSRemotingProtocolVersion 2.3\nSerializationVersion 1.1.0.1\nWSManStackVersion 3.0\n
Run Code Online (Sandbox Code Playgroud)\n注意:您必须已安装 WSMan,在 macOS 上更新 PowerShell 后可能需要重新安装。
\npwsh -Command \'Install-Module -Name PSWSMan\'\nsudo pwsh -Command \'Install-WSMan\'\n
Run Code Online (Sandbox Code Playgroud)\n
归档时间: |
|
查看次数: |
1752 次 |
最近记录: |