Skip to content

Instantly share code, notes, and snippets.

@vukasinterzic
Created October 18, 2023 04:00
Show Gist options
  • Save vukasinterzic/82416fea95ae4d715f353b4b07deccbe to your computer and use it in GitHub Desktop.
Save vukasinterzic/82416fea95ae4d715f353b4b07deccbe to your computer and use it in GitHub Desktop.
this script shows how to execute code stored in Gist from PowerShell.
# Replace with your Gist's raw URL
$gistUrl = "https://gist.githubusercontent.com/yourusername/raw/yourgistID/yourscript.ps1"
#Option 1
Invoke-RestMethod -Uri $gistUrl | Invoke-Expression
#Option 2
Invoke-Expression ((New-Object System.net.WebClient).DownloadString('$gistUrl'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment