Manage Windows Hosts from Linux

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Manage Windows Hosts from Linux相关的知识,希望对你有一定的参考价值。

Using Powershell


  • 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

[[email protected] ~]# 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的主要内容,如果未能解决你的问题,请参考以下文章

Django-- File "manage.py", line 16 ) from exc ^ SyntaxError: invalid syntax(

Remove ip from hosts.deny

Detaching a datastore or storage device from multiple ESXi 5.0 hosts

windows10怎么改hosts

windows10怎么打开hosts

当导用模块与包的import与from的问题(模块与包的调用)