Create a Visual Studio Project for your PowerShell Scripts

Are you eager to take advantage of Visual Studio PowerShell Tools? This video talks about how to create a Visual Studio Solution & Project to help you manage your PowerShell script files. If you’ve already got a set of one-off scripts, that doesn’t necessarily warrant a PowerShell module, but you still want to author, debug, … Read moreCreate a Visual Studio Project for your PowerShell Scripts

Still using PowerGUI? Get on the Visual Studio train!

Are you still using the old Quest / Dell PowerGUI tool to author your PowerShell scripts and modules? If so, you may want to consider getting off the PowerGUI train, and hopping onto the Visual Studio 2015 or PowerShell Integrated Scripting Editor (ISE) train! By doing so, you will improve your PowerShell script & module … Read moreStill using PowerGUI? Get on the Visual Studio train!

PowerShell ISE: Jump to Column Feature

If you’re a developer, or even just a frequent user of a text editor, you’re probably familiar with the “Jump to Line” feature of most text editing software. The Microsoft Windows PowerShell Integrated Scripting Editor (ISE) offers such a feature, which is commonly mapped to the CTRL + G keyboard shortcut. One of the features … Read morePowerShell ISE: Jump to Column Feature

PowerShell: Resizing Azure Virtual Machines

Background Did you know that you can scale virtual machines in Microsoft Azure? If you’ve been working with the cloud, you’ve most likely heard about that capability before, but did you know that you can automate this function using PowerShell? It’s true! You can streamline many different operations in Microsoft Azure, using the Azure PowerShell … Read morePowerShell: Resizing Azure Virtual Machines

PowerShell: Add Users to Active Directory Group from Text File

A customer recently requested a PowerShell script, to add Active Directory users to a security group. The list of users would come from a text file that resides on the filesystem. To that end, I wrote a short PowerShell script that does just that, complete with parameter validation. #requires -version 4.0 #requires -Module ActiveDirectory param … Read morePowerShell: Add Users to Active Directory Group from Text File

Decentralized Revision Control Tooling on Windows

Today I’d like to take a few minutes to talk about setting up Git for your development projects on the Windows platform. I’ve long been a fan of Mercurial, because the installation process is easy, and the tooling is native to the Windows platform. While Git and Mercurial are very similar version control tools, GitHub appears to be a stronger community hub, compared to Mercurial hosting sites like CodePlex and Bitbucket, and it’s worthwhile getting familiar with it.

Mercurial Tooling

TortoiseHg Overlay IconsAs I stated before, Mercurial is very easy to install on Windows, and it doesn’t have any additional dependencies that you have to worry about manually installing. While Mercurial itself is a command line tool, there’s also a project called TortoiseHg that offers GUI screens to perform common source control tasks, including: commits, file adds/removes, branching, repository configuration, and so on. In addition, TortoiseHg enables some handy Windows Explorer integration, namely overlay icons and context-sensitive context menu tools!

Read moreDecentralized Revision Control Tooling on Windows

Windows 8: Missing Resource Monitor? Not quite!

You might notice that in Windows 8, there is no shortcut to launch the Resource Monitor utility, which used to be readily available in Windows 7.

It was easy to launch Resource Monitor by simply hitting the Windows key on your keyboard, then typing the first few letters of the application’s name, and hitting enter (or maybe arrow-keying down a couple of entries, if there were ambiguous search results). In Windows 8, that shortcut no longer works by default, but Resource Monitor is not gone either. Some other websites out there have documented the fact that you can launch Performance Monitor navigating to the Performance node. On the Performance page, there is a link to open Resource Monitor; this spawns Resource Monitor into a separate window.

Read moreWindows 8: Missing Resource Monitor? Not quite!

PowerShell: Generating functions with dynamic parameter auto-completion values

Download the GetDevice PowerShell Module  There is a PDF copy of this entire blog post inside of the attached zip file. It’s much more readable. Introduction The purpose of this document is to describe the goal and solution for creating dynamically-injected parameter auto-completion values into PowerShell function definitions. This is simply a proof of concept, … Read morePowerShell: Generating functions with dynamic parameter auto-completion values

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?