Files

16 lines
478 B
PowerShell

param(
[Parameter(Mandatory = $true)]
[string]$BashCommand
)
$ErrorActionPreference = "Stop"
. "$PSScriptRoot\ProxmoxAgent.ps1"
$text = $BashCommand -replace "`r`n", "`n"
$bytes = [System.Text.Encoding]::UTF8.GetBytes($text)
$b64 = [Convert]::ToBase64String($bytes)
# On Proxmox host, run pct exec with base64 decoded directly inside container
$remoteCmd = "pct exec 102 -- bash -c 'echo " + $b64 + " | base64 -d | bash'"
Invoke-ProxmoxSshCommand -Command $remoteCmd