Getting Started with the Git Version Control System

There's a lot to Git and there's tons of information all over the web about it. There's so much information out there that you might feel overwhelmed when you first start trying to learn what Git is and how to use it. The purpose of this blog article is to help you install Git, teach you a few basics, and point you in the right direction to learn more. I'll start with a little background information: Back in 2009 when I started blogging on this site, I used the TechNet script repository to share Read more [...]

#PowerShell Script Module Design: Placing functions directly in the PSM1 file versus dot-sourcing separate PS1 files

So you've transitioned from writing PowerShell one-liners and scripts to creating reusable tools with functions and script modules. You may have started off by simply placing your functions in a PS1 file and dot-sourcing it. That leaves a lot to be desired though since it's a manual process and even if you've added some code to your profile to accomplish that task, the experience still isn't as good as it could be. Many of the short comings can be alleviated by simply placing your functions into Read more [...]

Building logic into PowerShell functions to nag users before their Active Directory password expires

This week I'm sharing a couple of PowerShell functions that are a work in progress to nag those users who seem to never want to change their passwords. I can't tell you how many times the help desk staff at one of the companies that I provide support for receives a call from a user who is unable to access email or other resources on the intranet. The problem? They have run their password down to the point where they arrive in the morning, log into their computer without issue, and during the day Read more [...]

Video: Demystifying Active Directory User Account Lockouts with PowerShell

A few months ago I created an audition video for Pluralsight on “Demystifying Active Directory User Account Lockouts with PowerShell” and I thought I would share that video with you, the readers of my blog site:

You can also find this video on my YouTube channel.

Happy New Year!

µ

Use PowerShell to Determine Services with a StartType of Automatic or Manual with Trigger Start

Newer Windows operating systems have numerous services that are set to start automatically or manually with a triggered start. The following image is from a machine that's running Windows 10 Enterprise Edition (version 1511): The problem is when you're trying to determine whether or not all of the services that are set to start automatically are running or not. These trigger start services can't be filtered out using the Get-Service cmdlet or with WMI and they aren't necessarily suppose to Read more [...]

StartType property added to Get-Service in PowerShell version 5 build 10586 on Windows 10 version 1511

If you've used PowerShell for more than 5 minutes, then you probably have some experience with the Get-Service cmdlet. As you could have guessed if you didn't already know, the Get-Service cmdlet retrieves information about Windows services. Depending on what you're trying to accomplish, that particular cmdlet could leave a lot to be desired. Want to know if a service is running? No problem. Want to know what the startup type is for one or more services? Sorry, you can't accomplish that task with Read more [...]

Video: Create Dynamic Reusable Tools in PowerShell with Advanced Functions

Last Thursday I presented a session for the Central Texas PowerShell Users Group on “DRY: Create Dynamic Reusable Tools in PowerShell with Advanced Functions”. The video from that presentation is now available:

The presentation materials including the code and a PDF copy of the slide deck can be downloaded from here.

µ

Central Texas PowerShell User Group Meeting Tonight!

This evening at 6pm central time, I'll be presenting a session on "DRY: Create Dynamic Reusable Tools in PowerShell with Advanced Functions" for the Central Texas PowerShell User Group. You can signup and find out more details about this presentation here. Here's what to expect from the session: "Bad habits never die. Writing the same PowerShell code over and over again with static values is no different than pointing and clicking in the GUI performing the same task over and over again. It’s Read more [...]

Installing Visual Studio Code and the PowerShell Extension

Last week Microsoft released a new version of Visual Studio Code along with an extension for writing PowerShell in it. Visit code.visualstudio.com to download Visual Studio Code. There's also an update link on that page if you happen to have a version prior to "0.10.1". The PowerShell extension for Visual Studio Code only works with PowerShell version 5. Either Windows 8.1 with the WMF 5 Production Preview installed or Windows 10 is sufficient. The GUI installation of Visual Studio Code is a Read more [...]

Using PSScriptAnalyzer to check your PowerShell code for best practices

Are you interested in learning if your PowerShell code follows what the community considers to be best practices? Well, you're in luck because Microsoft has a new open source PowerShell module named PSScriptAnalyzer that does just that. According to the GitHub page for PSScriptAnalyzer, it's a static code checker for PowerShell modules and scripts that checks the quality of PowerShell code by running a set of rules that are based on best practices identified by the PowerShell team and community. Read more [...]

Using Pester and the Operation Validation Framework to Verify a System is Working

If you haven't seen the Operation Validation Framework on GitHub, it's definitely something worth taking a look at. This framework allows you to write Pester tests to perform end-to-end validation that a system is operating properly. Pester is typically used to perform test driven development or unit testing on your PowerShell code, but in this scenario it's used for operational testing. You need to have Pester installed, but if you're running Windows 10 then you already have Pester. Download Read more [...]

Solving DSC Problems on Windows 10 & Writing PowerShell Code that writes PowerShell Code for you

I recently ran into a problem with DSC on Windows 10 when trying to create MOF files with DSC configurations that work on other operating systems. An error is generated when the friendly name for a DSC resource contains a dash and that friendly name is specified as a dependency for another resource. I know that only certain characters are allowed in the name that's specified for DependsOn and I've run into similar problems with things such as IP addresses due to the dot or period, but the dash works Read more [...]

Video & Presentation Materials: October Omaha PowerShell User Group Meeting

This past Tuesday, I presented a session on "Using PowerShell Desired State Configuration in your On-Premises Datacenter" for the Omaha PowerShell User Group. During that presentation I demonstrated a number of the tips and tricks that I've learned while implementing systems in multiple data-centers using DSC. The meeting was recorded and the video from it is now available:   You can download a PDF copy of the slide deck along with both of the scripts used during the presentation Read more [...]

Using Pester to Test PowerShell Code with Other Cultures

I recently published a blog article on unexpected case sensitivity in PowerShell. An example in that blog article uses the contains method which is indeed case sensitive. One of the workarounds that I demonstrated was to convert whatever the user entered to upper case using the ToUpper() method. One of the reasons I like blogging is that many times there are things that I may not have considered and sometimes things that I wasn't even aware of so in addition to sharing my knowledge with others, Read more [...]

Some Cases of Unexpected Case Sensitivity in PowerShell

I'm sure that you've all heard that PowerShell is case insensitive, right? Most things in PowerShell are indeed case insensitive and what is case sensitive is normally expected behavior, but I've come across a number of things in PowerShell that are case sensitive that don't work as I would expect them to which are listed in this blog article. One of the first things that I discovered in PowerShell that is case sensitive that you wouldn't have thought would be is the Region keyword that was introduced Read more [...]