Command Shortening
22.1.16
Ok, so now you have your PowerShell file in the cloud, but you have a 156 character command, how can this be shortened?
Alias
Start by using the PowerShell alias iex to replace Invoke-Expression, and irm instead of Invoke-RestMethod. Now you are down to 128 characters
Parameter Names
You can leave off the mandatory parameter names for iex and irm to trim down to 114 characters
Splitting Hairs
Finally, you can lose the quotes around the URL if you don't have any special characters and possibly https://, but that won't recover much. You can also change replace the parenthesis with a pipe to iex, which gets you to 104, but that's still too long
URL Shortener
Another option is to use a URL Shortener service, but make sure you test it first as there are no guarantees this will work. The following two have been tested and work fine
Bitly
ShortURL
Domain Forwarding
One benefit of using GitHub Raw links is that the MIME information is presented as Text. If you are linking to another source, you may be prompted to download the ps1 file rather than viewing the text
This makes it very easy to use in OSDCloud
Sponsor
Last updated