PowerShell Rick Roll: How the ASCII Prank Works (and Why You Should Read the Script First)
There's a one-liner that has been floating around PowerShell circles for years. Paste it into a prompt, hit Enter, and within a few seconds your terminal turns into an animated ASCII video with a song playing over it. If you've ever been on the receiving end of it, you know exactly what just happened to you. It's the Rick Roll, and it is one of the most reliable pranks in the language.
I keep it around for what it teaches you about how PowerShell actually works — and, more importantly, about what you should never do with a command you copied off the internet. This post walks through how the trick is built, then does the part almost nobody does: treating the script like the untrusted download it is.
What You're Actually Running
The version most people know is a single line:
iex (New-Object Net.WebClient).DownloadString('http://bit.ly/e0Mw9w')
Strip away the prank and that line does three things in sequence. New-Object Net.WebClient builds an HTTP client. .DownloadString(...) fetches whatever lives at that URL and hands it back as a single string. And iex — Invoke-Expression — takes that string and executes it as PowerShell.
So the entire operation is: download text from a web address, then run it. There is no install step, no package manager, no signature check, no hash to compare against. The URL does all of the trust work, and here it's a short link pointing at someone's personal domain. That is the whole model: you are trusting that the shortener still resolves, that the domain is still the same person's, and that nothing between your machine and that server has changed what gets served to you.
How the ASCII Animation Is Built
Once you actually pull the script down and read it, the magic is less spooky than it looks. The payload is a base64 string. The script decodes it, gunzips it, and what comes out is plain PowerShell plus a big block of data describing an animation frame by frame.
The frames are stored as tab-separated strings — each one a still image made of characters. A loop walks through them in order and re-scales each character grid so the aspect ratio lines up with your console window, expanding runs of characters with a randomized pattern so the picture doesn't collapse into a blocky smear. Then it writes the frame to the screen, waits a beat, and moves on.
The console setup is where PowerShell gets a little under the hood. The script reaches into $host.UI.RawUI to set the window size, buffer size, and foreground and background colours — black on white, which is what makes the ASCII art readable. It wraps those calls in try/catch because not every host lets you resize itself, and it would rather keep going than die on a read-only prompt.
The audio is separate from the picture. The original plays an mp3 straight off the network using a COM media object; the "run locally" variant swaps that remote address for a file next to the script. So the two things you change when you take it offline are exactly the two that point at the internet: where the script comes from, and where the song comes from.

The Part Almost Nobody Does: Treat It Like Untrusted Code
Here is where the prank and my actual job as a sysadmin collide. That one-liner is the exact pattern I tell people to fear, and I would rather say it than have you learn it from a real incident.
iex (DownloadString(...)) over plain HTTP is a download button with no hash. There is nothing between you and that string — no TLS pinning on a short link, no checksum to verify the bytes you got are the ones the author meant, no signature to say who wrote it. The post this is based on even carries its own warning: you are grabbing a script from a website and running it locally, so you are hoping the link doesn't get taken over. That is not paranoia; that is the actual threat model of copy-paste execution.
A shortener makes it worse, not better. The bit.ly link is a single point of failure and a single point of compromise. If that account is sold, phished, or simply abandoned until the domain lapses, the same "harmless" one-liner now points at whatever the new owner serves. The prank script becomes a loader for something else, and the only difference between the two is intent on the other end of the URL.
So I don't run it that way. Not because the Rick Roll is dangerous — it isn't — but because I want the habit automatic before I meet a script that isn't a joke.

The Safe Way to Run It Locally
The "run locally" version exists for exactly this reason, and it is the one I would actually keep. You download the script once, as a file, and read it before you run it. That single step — opening the .ps1 in an editor and scrolling through it — is what separates a prank from a supply-chain incident.
Once you've read it and it does what you expect (animates some ASCII, plays a song, touches nothing else), you make the two local changes:
- Point the script at itself instead of the remote URL, so it isn't re-fetching anything at runtime.
- Point the audio at an mp3 sitting in the same folder as the script.
Then you run it like any local file:
powershell -ExecutionPolicy Bypass -File .\rickroll.ps1
Now the whole thing is self-contained. Nothing is fetched from the internet when you run it, so there is nothing to be taken over between the moment you saved it and the moment you press Enter. If you want to be thorough, hash the file the day you save it and re-hash it before you run it a few months later — if the number changed, something touched the file and you want to know why. That is the whole discipline: don't trust the download button, trust the hash.
There is one real caveat with local PowerShell scripts. Windows refuses to run a .ps1 from an untrusted location until you deal with the execution policy — the "running scripts is disabled on this system" error most people hit first. -ExecutionPolicy Bypass on the command line overrides it for that single invocation without changing your machine-wide setting, which is the least-surprising way to do it. If you would rather not bypass anything, you can unblock the specific file after downloading it with Unblock-File .\rickroll.ps1.

The Short Version
The Rick Roll one-liner is a fun piece of PowerShell, and a good one to actually read, because it shows you how iex, a base64 payload, and the RawUI console all fit together. But the version that downloads and executes over HTTP from a short link is exactly the pattern to be wary of — no hash, no signature, one compromised URL away from doing something else. Download it as a file, read it, point both remote references at local files, and run it with -File. Then the prank stays a prank, and the habit carries over to every script you will ever paste.
Don't trust the download button. Trust the hash.
If this was useful, More hands-on tech guides at TechGeek. No pressure — read it whenever it's useful.