Writing Interactive Scripts with PowerShell

If you’re authoring PowerShell scripts that are intended to be interactive, there are a couple of very easy ways to ask your users for input. Typically, user input falls into a couple categories: free-form text input, or a list of pre-defined values. We also might need to prompt the user …

Continue reading

Implementing a .NET Class in PowerShell v5

Introduction You might have heard that PowerShell version 5.0 has introduced support for building .NET classes. Indeed, this is a powerful, new capability that has not previously existed in native PowerShell syntax. Before the new class-building syntax existed, if you wanted to build custom objects in PowerShell, you generally would …

Continue reading

PowerShell: Measuring Download Speeds

Have you ever downloaded a file from the Internet? Probably. Have you ever downloaded a file with PowerShell? Maybe. Have you ever wondered how fast your download was going? Sure. Have you ever wondered how to get that information when you’re downloading a file with PowerShell? Maybe, but you didn’t …

Continue reading

PowerShell: Embed binary data in your script

When writing automation scripts or modules, you might find that you frequently reference external binary data. “Binary data? Well, that accounts for all data!” you might say. Yes, that’s true. But I’m talking about binary data as opposed to files containing simple ASCII or UTF-8 data. Maybe there’s some better …

Continue reading

PowerShell: Tracert or Trace-Route?

UPDATE (2012-07-27): Justin Dearing (@zippy1981) sent me an updated version of the script, which improves on the following: Has some comment-based help Parameter checking Grab it here: Invoke-TraceRoute.ps1 Any network or systems administrator is familiar with the good old tracert.exe utility that’s been included outof-the-box in Windows for years now. …

Continue reading

PowerShell: Twitter Folks

Hey folks, here are some of the top tweeters on the topic of PowerShell! All of them come with my strong recommendation to follow them! You will be in good company, and will probably learn a LOT, if you keep in touch with these ridiculously smart folks. Jeffrey Snover – …

Continue reading

PowerShell: Finding Friday the 13th

Update (2012-01-13): Justin Dearing (aka @zippy1981) informed me that it would be more efficient to look at the 13th of each month, and test if it was a Friday. In theory at least, he’s absolutely correct; I wrote the function the first way I thought of it, and I always …

Continue reading

PowerShell: Shortening Web Service Type Names with a Hashtable

When you use the New-WebServiceProxy class, you probably have noticed that PowerShell dynamically generates some really ugly type names. For example, if we get a reference to the Bing web service (you’ll need to get an API key first): $BingSearch = New-WebServiceProxy -Class BingSearch -Uri "http://api.search.live.net/search.wsdl?AppID=$ApiKey" … and examine the …

Continue reading