PowerShell/docs/building/psrp.md
2016-03-31 16:19:10 -07:00

2.6 KiB

PowerShell Remoting Protocol

This guide supplements the Linux instructions, as building PowerShell Remoting Protocol (PSRP) support first requires PowerShell on Linux built.

PSRP communication is tunneled through the Open Management Infrastructure (OMI) using the OMI provider.

PSRP has been observed working on OS X, but the changes made to OMI to accomplish this are not even beta-ready and need to be done correctly. They exist on the andschwa-osx branch of the OMI repository.

Environment

Toolchain Setup

PSRP requires the following additional packages:

sudo apt-get install libpam0g-dev libssl-dev libcurl4-openssl-dev libboost-filesystem-dev

Git Setup

Two additional submodules need to be initialized:

git submodule update --init -- src/omi src/omi-provider

The src/omi submodule requires your GitHub user to have joined the Microsoft organization. If it fails to check out, Git will give up and not check out further submodules either. Please follow the instructions on the Open Source Hub.

Building

Run ./omibuild.sh to build OMI and the provider.

This script first builds OMI in developer mode:

pushd src/omi/Unix
./configure --dev
make -j
popd

Then it builds and registers the provider:

pushd src/omi-provider
cmake -DCMAKE_BUILD_TYPE=Debug .
make -j
popd

The provider maintains its own native host library to initialize the CLR, but there are plans to refactor .NET's packaged host as a shared library.

Running

Some initial setup on Windows is required. Open an administrative command prompt and execute the following:

winrm set winrm/config/Client @{AllowUnencrypted="true"}
winrm set winrm/config/Client @{TrustedHosts="*"}

You can also set the TrustedHosts to include the target's IP address.

Then on Linux, launch omiserver (after building with the instructions above):

./psrp.sh

Now in a PowerShell prompt on Windows (opened after setting the WinRM client configurations):

Enter-PSSession -ComputerName <IP address of Linux machine> -Credential $cred -Authentication basic

The $cred variable can be empty; a credentials prompt will appear, enter any fake credentials you wish as authentication is not yet implemented.

The IP address of the Linux machine can be obtained with:

ip -f inet addr show dev eth0