Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Latest posts

Oct 21, 2016
Post comments count 0
Post likes count 2

PowerShell regex crash course – Part 4 of 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows the basics of working with regular expressions in PowerShell. Hello! I’m Thomas Rayner, a proud Cloud & Datacenter Management Microsoft MVP, filling in for The Scripting Guy! this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a five-part crash course about how to use regular expressions in PowerShell. Regular expressions are sequences of characters that define a search pattern, mainly for use in pattern matching with strings. Regular expressions are extremel...

Oct 17, 2016
Post comments count 0
Post likes count 0

Speed up remote PowerShell connection to Exchange

Doctor Scripto

Summary: Speed up the connection to Exchange by importing only the cmdlets that you need. Is there a way to speed up the initial PowerShell connection to Exchange? Yes, of course! With a little modification to Import-PSSession, we can speed up the connection. Normally, you would connect to Exchange 2010/2013/2016 like this: $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'http://ex01/PowerShell/?SerializationLevel=Full' -Authentication Kerberos Import-PSSession -Session $session This would import all available cmdlets in the local PowerShell session. But, consider the next...

Oct 14, 2016
Post comments count 0
Post likes count 0

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

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 they exist within the string You’ll have to manually escape and because is a bit quirky.

Oct 14, 2016
Post comments count 0
Post likes count 1

PowerShell regex crash course – Part 3 of 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud & Datacenter Management MVP, shows the basics of working with regular expressions in PowerShell. Hello! I’m Thomas Rayner, a proud Cloud & Datacenter Management Microsoft MVP, filling in for The Scripting Guy! this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a five-part crash course about how to use regular expressions in PowerShell. Regular expressions are sequences of characters that define a search pattern, mainly for use in pattern matching with strings. Regular expressions are extrem...

Oct 7, 2016
Post comments count 0
Post likes count 0

PowerTip: How to detect phone numbers using regular expressions

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 for a phone number. Here in Canada, our phone numbers are 10 digits. Here is an example:

Oct 7, 2016
Post comments count 0
Post likes count 1

PowerShell regex crash course – Part 2 of 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows the basics of working with regular expressions in PowerShell. Hello! I’m Thomas Rayner, a proud Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy! this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a five-part crash course about how to use regular expressions in PowerShell. Regular expressions are sequences of characters that define a search pattern, mainly for use in pattern matching with strings. Regular expressions are extremely ...

Oct 5, 2016
Post comments count 0
Post likes count 0

Part 2 – Install .NET Core and PowerShell on Linux Using DSC

Doctor Scripto

Summary: Learn how to configure and use PowerShell, Bash, and desired state configuration (DSC) with Linux. Today, Cloud and Data Center MVP Stefan Roth returns for Part 2 of his three-part series about how to configure and use PowerShell, Bash, and desired state configuration (DSC) with Linux. Take it away Stefan … My previous post installed the foundation for this second part. It installed the OMI CIM server and DSC on Linux. In this part, the goal is to run a DSC configuration on Linux to download and install .NET core libraries and Windows PowerShell for Linux. There is a multi-step process to get this don...

Sep 30, 2016
Post comments count 0
Post likes count 0

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

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.

Sep 30, 2016
Post comments count 0
Post likes count 1

PowerShell regex crash course – Part 1 of 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows the basics of working with regular expressions in PowerShell. Hello! I’m Thomas Rayner, a proud Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy! this week. You can find me on Twitter (@MrThomasRayner) or posting on my blog, workingsysadmin.com. This week, I’m presenting a five-part crash course about how to use regular expressions in PowerShell. Regular expressions are sequences of characters that define a search pattern, mainly for use in pattern matching with strings. Regular expressions are extremely u...