Confirming/Validating PowerShell Get-Credential Input Before Use

Have you ever used Get-Credential to generate credentials in PowerShell, only to find out when you go to use those credentials that they were invalid? It’s even worse when you are doing this in a script where the script throws errors every time the invalid credentials are used, and you have to restart the script…

8

Tracking and Controlling PowerShell Script Execution Progress via XML

Have you ever wanted to track the progress of one of your multi-step/stage PowerShell scripts on a computer, just in case during the middle of the steps the script (or PowerShell itself) terminates unexpectedly, or something randomly reboots the computer? How about if the script is supposed to reboot the computer running it at various…

6

PowerShell code to wait for a background process to finish before continuing on with a script

While this code was originally developed for an Exchange script, you can use it for any PowerShell script where you want to make sure some background process/service is finished before proceeding on with the rest of your script. I recently ran into a problem where a PowerShell scripted install/upgrade of Exchange 2016 server where the…

8

PowerShell [DateTime] throws the error “String was not recognized as a valid DateTime.”

In some of my scripts, such as Get-AutoDiscoverRecords.ps1, I convert the string output of another command (such as an LDAP query) into a Date and Time variable by using the type cast [DateTime]. For example the following will turn the string “06/16/2016 3:14:03 PM” into a PowerShell DateTime object for June 16th 2016 at 3:14PM:…

2

Use PowerShell to determine the first and last days of the current calendar quarter.

Time for some fun with PowerShell. 🙂 ***Updated to include code Eric created to determine the last day of the quarter at the bottom of this entry*** My colleague Eric Powers has PowerShell script that queries a bunch of data from the last 90 days. The intention of the script is to only collect data…

3

Leveraging the PowerShell Script Version Control Process for Exchange Cumulative Update Distribution

This is the second in a two-part blog post covering the topic of how to maintain version control over PowerShell scripts and Exchange 2016 deployment files in a large environment. The first blog post should be reviewed before continuing here because the information below builds on the PowerShell Version Control Process (PSVCP) established in that…

0

Maintaining Version Control Over Distributed PowerShell Scripts

This is the first in a two-part blog post covering the topic of how to maintain version control over PowerShell scripts and Exchange 2016 deployment files in a large distributed environment (the second post titled Leveraging the PowerShell Script Version Control Process for Exchange Cumulative Update Distribution is now live). I say large environment because…

5