Using Powershell
On the target with Windows system, configure the WinRM server to accept Basic authentication and allow unencrypted traffic .
To enable basic Auth, on the Windows in an administrative command prompt run:
WinRM set Winrm/config/service/auth @{basic= "true"}
To enable unencrypted communication-over HTTP on Windows in a administrative command prompt you must also run:
WinRM set Winrm/config/service @{allowunencrypted= "true"}
Note These commands is run in CMD, not PowerShell.
Basic authentication with WinRM can only access local machine accounts so you'll need to use a local account on your Win Dows machine, which is part of the Administrator group, with our test environment, you can use administrator.
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
[[email protected] ~]# PowerShell
PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
ps/root> $IP = "192.168.xx.xx" (this is the IP of Windows host)
ps/root> $cred =get-credential
Windows PowerShell Credential Request
Enter your credentials.
User:administrator
Password for User administrator: ******** (This is interactive, you need to enter the user name, password on 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
would update later.
Manage Windows Hosts from Linux