Manage Windows Hosts from Linux
2021-07-15 21:17
标签:powershell ssh comandline remote windows Configurations on the Windows Host On the target with Windows system, configure the WinRM server to accept basic authentication and allow unencrypted traffic. To enable basic auth, on Windows in an administrative command prompt run: winrm set winrm/config/Service/Auth @{Basic="true"} To enable unencrypted communication over http on Windows in an administrative command prompt you must also run: winrm set winrm/config/Service @{AllowUnencrypted="true"} Note these commands are run in CMD, not PowerShell. Basic authentication with WinRM can only access local machine accounts so you will need to use a local account on your Windows machine that is part of the administrator group, in our test environment, you can use administrator. Configurations on the Linux Host On the host with Linux System, install PowerShell and set the environment variable, then run PowerShell to connect target system. 1. Install PowerShell Download the RPM installer, then run: rpm -i powershell-xxx.rpm If the system asks for dependency packages, please use yum or apt-get to install them. 2. Set the environment variable echo “export LD_LIBRARY_PATH=psl-omi-provider-path/src:psl-omi-provider-path/omi/Unix/output/lib:${LD_LIBRARY_PATH}” >> /etc/profile source /etc/profile 3. Run PowerShell to connect to target system [root@Linux ~]# powershell PowerShell Copyright (C) Microsoft Corporation. All rights reserved. PS /root> $IP="192.168.xx.xx" (这里是Windows Host的IP) PS /root> $cred=Get-Credential Windows PowerShell credential request Enter your credentials. User: administrator Password for user administrator: ******** (这里是交互式的,需要输入Windows Host上的用户名、密码) PS /root> Enter-PSSession -ComputerName $IP -Credential $cred -Authentication basic [10.239.56.110]: PS C:\Users\Administrator\Documents> ipconfig Reference: https://github.com/PowerShell/PowerShell https://github.com/Microsoft/omi/blob/master/Unix/doc/setup-ntlm-omi.md Using SSH Will update later. Manage Windows Hosts from Linux 标签:powershell ssh comandline remote windows 原文地址:http://blog.51cto.com/548260/2106884
文章标题:Manage Windows Hosts from Linux
文章链接:http://soscw.com/essay/105750.html