Skip to content

Functions to install PowerShell Core on a Remote Host. Opitionally configure pwsh PSRemoting on the Remote Host. All you need is ssh.

License

Notifications You must be signed in to change notification settings

pldmgg/BootstrapPowerShellCore

Repository files navigation

Build status

BootstrapPowerShellCore

This Module allows you to install PowerShell Core on a Remote Host and optionally configure pwsh for PSRemoting. The only requirement is that you have ssh available on your local workstation. (See my WinSSH Module if you would like an easy way to install/configure OpenSSH on Windows)

The target Remote Host can be (almost) any Operating System mentioned in Microsoft's official documentation (with the exception of Kali): https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell?view=powershell-6

The Module itself can be installed and imported using Windows PowerShell 5.1 or and Powershell Core 6.X (Windows or Linux).

I will eventually add support for Kali.

Getting Started

# One time setup
    # Download the repository
    # Unblock the zip
    # Extract the BootstrapPowerShellCore folder to a module path (e.g. $env:USERPROFILE\Documents\WindowsPowerShell\Modules\)
# Or, with PowerShell 5 or later or PowerShellGet:
    Install-Module BootstrapPowerShellCore

# Import the module.
    Import-Module BootstrapPowerShellCore    # Alternatively, Import-Module <PathToModuleFolder>

# Get commands in the module
    Get-Command -Module BootstrapPowerShellCore

# Get help
    Get-Help <BootstrapPowerShellCore Function> -Full
    Get-Help about_BootstrapPowerShellCore

Examples

Scenario 1: Install pwsh on Remote Host

$BootstrapPwshSplatParams = @{
    RemoteHostNameOrIP      = "zerowin16sshb"
    DomainUserName          = "zero\zeroadmin"
    DomainPasswordSS        = $(Read-Host -Prompt "Enter password" -AsSecureString)
}
Bootstrap-PowerShellCore @BootstrapPwshSplatParams

Scenario 2: Install pwsh AND configure sshd_config for PSRemoting...

$BootstrapPwshSplatParams = @{
    RemoteHostNameOrIP      = "centos7nodomain"
    LocalUserName           = "centos7nodomain\vagrant"
    LocalPasswordSS         = $(Read-Host -Prompt "Enter password" -AsSecureString)
    ConfigurePSRemoting     = $True
}
Bootstrap-PowerShellCore @BootstrapPwshSplatParams

Scenario 3: Install pwsh using the latest package from GitHub (as opposed to the Package Management system of the target OS)

$BootstrapPwshSplatParams = @{
    RemoteHostNameOrIP      = "centos7nodomain"
    LocalUserName           = "centos7nodomain\vagrant"
    LocalPasswordSS         = $(Read-Host -Prompt "Enter password" -AsSecureString)
    UsePackageManagement    = $False
}
Bootstrap-PowerShellCore @BootstrapPwshSplatParams

Notes

About

Functions to install PowerShell Core on a Remote Host. Opitionally configure pwsh PSRemoting on the Remote Host. All you need is ssh.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published