Command Shortening


Ok, so now you have your PowerShell file in the cloud, but you have a 156 character command, how can this be shortened?

Invoke-Expression -Command (Invoke-RestMethod -Uri '')


Start by using the PowerShell alias iex to replace Invoke-Expression, and irm instead of Invoke-RestMethod. Now you are down to 128 characters

iex -Command (irm -Uri '')

Parameter Names

You can leave off the mandatory parameter names for iex and irm to trim down to 114 characters

iex (irm '')

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

irm | iex

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



Domain Forwarding

Another option you can try is to do Domain Forwarding. This won't work with all hosts, but you may be able to redirect a subdomain if your DNS Host supports this. I use Google Domains for and they make it very easy to do this in their Admin Console

This quickly allows me to get to my PSCloudScript by simply going to

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

OSDeploy is sponsored by Recast Software and their Systems Management Tools

Last updated