Browsed by
Author: Nicholas M. Getchell

Nicholas Getchell is a Systems Analyst at Massasoit Community College working on automation, deployment and security. Nicholas is also a member of the Association for Windows PowerShell Professionals and coordinates the TechSession webinars for PowerShell.org. You can find him on Twitter @getch3028 or on the PowerShell Slack community as ngetchell. Follow his PowerShell blog at PowerShell.Getchell.org.
Adding Updates to a Wim File

Adding Updates to a Wim File

Even with Microsoft releasing new Windows 10 builds on a twice-yearly basis, there is still a case to be made to slipstream updates into your install media. First, you never have to worry about whether your computer gets needed patches. If you build in protection against the Wanna Cry malware by patching MS17-010 you can. Second, it saves a decent amount of time during computer provisioning. No need to push down the original copy of a file as well as…

Read More Read More

Never Lose Your Work at the Console

Never Lose Your Work at the Console

If you’re like me, every once in a while you have a dash of brilliance, write the perfect one-liner, but forget to record your work. You know you solved this problem already, but none of your documentation bears witness. You’re a trapeze artist without a safety net when you work at the console. Now, between transcripts, saving previous output, and HistoryPX, you won’t have to worry. Transcripts Transcripts are exactly what you think they are. They are a character for…

Read More Read More

Tail a File in PowerShell

Tail a File in PowerShell

In my limited Linux administration experience I got used to dealing with text. Text documents that held configuration files, text manipulation in the pipeline, text everywhere. Every search was just a grep away. When troubleshooting in Linux you’re constantly reading log files. Checking for changes and seeing if your what you’re flushing comes out the correct pipe. A tool that made the job easier was the tail command with the -f argument. This allows you to follow whatever is appended…

Read More Read More

Update-ModuleManifest is Back

Update-ModuleManifest is Back

Starting with Windows Management Framework 5.1 PowerShell now comes with Update-ModuleManifest. This is after Update-ModuleManifest broke and was removed from WMF 5. WMF 5.1 has been added to Windows 10 build 14342 and can be installed using the fast ring. Note: If you’ve been relying on a wildcard to load all of your exported functions you may run into issues. See, using wildcards cause up to 15 seconds of lag when loading the module. The new Update-ModuleManifest now explicitly creates…

Read More Read More

How I Work: Pester Testing

How I Work: Pester Testing

Ever since the 2015 North America PowerShell Summit I’ve become addicted to Pester testing. I use it for Unit Testing as well as Operational Validation. Not only the Pester open source but it is actually included in Windows 10. The rumor at the summit was that this was the first open source software built into Windows. This is truly a new Microsoft. I also use Generic Pester Tests to make sure my code stays up to my standards. Exported functions…

Read More Read More

Generic Pester Tests

Generic Pester Tests

Writing good Pester Tests is hard. Use your PowerShell knowledge to make things easier with Generic Pester Tests. Module Testing There are many requirements for module manifest to work everywhere. You need a root module to load your .PSM1, you need a version number so PowerShell knows which version to load into the console at runtime, and there should also be identifying information for more information. If you plan on publishing to the PowerShell Gallery you also need to include…

Read More Read More

Export to Excel

Export to Excel

If you handle any sort of data in your job you’ve likely run into the common PowerShell cmdlets for dealing with data; Import-CSV, Export-CSV, Import-CliXML, and Export-Clixml. Sometimes, automation requires the processing of data. CSV and XML are both great ways to store and send data. The only thing is, no human chooses to manipulate data in CSV or XML. That is, for better or for worse, in the realm of Excel. Opening in Excel Excel has the ability to…

Read More Read More

Installing Modules

Installing Modules

Whether you’re writing scripts, functions to automate a repetitive task, or building a whole toolkit you should be familiar with installing modules. Modules let you group functions in a logical way. Creating a bunch of functions that automate part of your Active Directory environment? Group them all into a module. Modules help by letting you keep track of the version you have installed on your machine as well as allowing for automatic loading into the current session. Module Contents What…

Read More Read More

Time Your Script with Timespan Objects

Time Your Script with Timespan Objects

Speed and consistency are the two main reasons people automate tasks using PowerShell. Give your script the same inputs and it should produce the same outputs. The consistency concept is easy. What about how much time is saved using PowerShell? We can achieve this using the Timespan object built into PowerShell. Start and Stop Times A rudimentary way of keeping track of time in your code is to use Get-Date. $StartTime = Get-Date Divide-Number -Dividend 39 -Divisor 3 $EndTime =…

Read More Read More