Showing results for PowerTip - Scripting Blog [archived]

Oct 14, 2016
Post comments count0
Post likes count0

PowerTip: How to detect a valid Active Directory user name using regular expressions

Doctor Scripto
Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how use regex to detect if a string is a valid Active Directory user name. The invalid characters for an Active Directory user name are and . How do I tell if a string is a valid Active Directory user name?   You can treat this array of characters as a pattern and see if t...

Windows PowerShellPowerTipguest blogger
Oct 7, 2016
Post comments count0
Post likes count0

PowerTip: How to detect phone numbers using regular expressions

Doctor Scripto
Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to use regex to detect if a string is a phone number. I have an array like , and I need to know which array items are phone numbers. How can I do this? You can compare each item in the array with all its non-digit characters removed and see if that matches your requirements f...

Windows PowerShellPowerTipguest blogger
Sep 30, 2016
Post comments count0
Post likes count0

PowerTip: How to escape characters in a string using regular expressions

Doctor Scripto
Doctor Scripto

Summary: Cloud & Datacenter Management MVP, Thomas Rayner, shows how escape characters for use in regex. Is there a way to escape characters in a string automatically for use in regex?  Use the method to automatically escape characters in a string so you can use them in regex.

Windows PowerShellPowerTipguest blogger
Sep 16, 2016
Post comments count0
Post likes count0

PowerTip: Use PowerShell to retrieve the date and time of the given time zone ID

Doctor Scripto
Doctor Scripto

Summary: Use PowerShell to pull out specify TimeZone data from an object. I have data retrieved from an external source that contains different time zone IDs like W. Europe Standard Time, AUS Eastern Standard Time, etc. How can I get the current date time value of it by using PowerShell? In PowerShell, use [System.TimeZone] and invoke the Conver...

Windows PowerShellPowerTipguest blogger
Aug 19, 2016
Post comments count0
Post likes count0

PowerTip: Use PowerShell to list all possible colors in the console

Doctor Scripto
Doctor Scripto

Summary: Use PowerShell and enumeration to access all possible colors that you can use in the console. Is there a way to see all of the available colors that I can use when using Write-Host? We sure can! Why, with just one line in PowerShell, you’re all done! Here is an example:

Windows PowerShellPowerTipguest blogger