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 have a solution until now!

Our web browsers calculate download speeds for us, somehow. Specifically how, I have no clue, but what I do know is that we are more than capable of calculating download speeds using PowerShell.

Read morePowerShell: Measuring Download Speeds

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 terminology to describe that, but hey it works for now. Binary data could include things such as:

  • Word documents
  • Executable (Portable Executable format)
  • Code libraries (DLLs)
  • Registry files
  • etc.

In the case of executables, oftentimes they provide useful functionality that would take many lines of PowerShell code to replicate. Some developers, for better or for worse, elect to use these utilities instead of going through the effort of writing the necessary code to handle the function natively in PowerShell. This creates an additional dependency when porting the PowerShell code, as the author must be sure to include the utility with their code, or otherwise ensure (via documentation, for example) that the target user will already have it available.

Wouldn’t it be nice if you didn’t have to depend on the user having some executable pre-installed, just to get your script to work, though? Unfortunately the little topic of “software licensing” can sometimes prevent redistribution of software that you are not given explicit permission to copy, however there are also many cases where this is allowed (eg. open-source projects). The work-around in cases where redistribution is not allowed, is to either direct the user where to download the software from, or automate it for them.

Read morePowerShell: Embed binary data in your script

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. Tracert allows you to identify each “hop” (typically a router) between two IP endpoints on a network. Since this utility was developed long before PowerShell existed, and has been time-tested, it hasn’t been implemented yet as a PowerShell cmdlet. That being said, PowerShell folks often do not enjoy reliance on external dependencies, and prefer the flexibility of an API that can provide only the information that they want or need. To that end, I have developed a Trace-Route PowerShell advanced function (cmdlet) that emulates a limited set of functionality offered by tracert.exe.

Read morePowerShell: Tracert or Trace-Route?

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 welcome suggested improvements. This morning … Read more PowerShell: Finding Friday the 13th

PowerShell: Move ConfigMgr Collections

Introduction If you work with Microsoft System Center Configuration Manager (SCCM / ConfigMgr) 2007 in any capacity, you probably are familiar with the concept of "collections" and how painful they can be to work with sometimes. The ConfigMgr console does not provide any method of moving a collection from one parent to another, and the … Read more PowerShell: Move ConfigMgr Collections

PowerShell: Dynamic Parameters and Parameter Validation

Background on Parameter Validation PowerShell advanced functions allow their creators to specify a fair amount of metadata that describes their parameters. One huge benefit of parameter declarations in PowerShell is that it’s possible to validate input right at the parameter level, before you execute any code in the body of the function. This helps make … Read more PowerShell: Dynamic Parameters and Parameter Validation