Watch Rick Astley Dance and Sing!

by Nov 14, 2014

All PowerShell Consoles (not PowerShell ISE)

Before you try this, you may want to click the icon in the upper left corner of the PowerShell title bar, go to properties, and choose a small font.

Next, try and run this command:

(New-Object Net.WebClient).DownloadString("http://bit.ly/e0Mw9w") 

As you will see, it downloads an entire PowerShell script. Now – if you trust that code – you could make PowerShell immediately execute it by using the (dangerous) Invoke-Expression. It’s dangerous because it can allow hackers to download and immediately execute all kinds of stuff. This example is benign, though. Just make sure you run it in a PowerShell console, not the PowerShell ISE! You may also crank up the volume.

Invoke-Expression (New-Object Net.WebClient).DownloadString("http://bit.ly/e0Mw9w") 

Twitter This Tip! ReTweet this Tip!