Skip to content

Instantly share code, notes, and snippets.

@thecliguy
Last active December 4, 2018 14:50
Show Gist options
  • Save thecliguy/0422a7b1fc7042dc55b4374a7a1305ff to your computer and use it in GitHub Desktop.
Save thecliguy/0422a7b1fc7042dc55b4374a7a1305ff to your computer and use it in GitHub Desktop.
Upload Binary
$sourcefile = read-host "Enter source file path"
$destfile = read-host "Enter destination file path"
$content = Get-Content -Path $sourcefile -Encoding Byte
$Base64 = [System.Convert]::ToBase64String($Content)
Invoke-Command -computername <computername> -credential (get-credential) -scriptblock {$x = [System.Convert]::FromBase64String($Using:Base64); Set-Content -Path $using:destfile -Value $x -Encoding Byte}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment