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:…

3