How the Powershell Split method helps AD admins.

The manager of the sales department requested for changing department attribute value for some users. He sent users list via email messages. Sound familiar? Meet Bob and his one story and Powershell split trick he discovered.

Bob is an Active Directory administrator. He loves his job. A few months ago, he started to learn Powershell. Now, it’s the most used tool in his job. He loves to automate his jobs.

Bob has one problem. When someone requests to change something in Active Directory, sent him a list of users in email messages. He tried to teach requesters, that they should send him a CSV file with a list of users, then he can finish his task faster. Unfortunately, nobody does as he said.

Bob found solutions. It’s a Powershell Split method.

Bob pasted users list from an email message into Powershell console. When he did this, the Powershell recognized the list as one text (string). The Active Directory admin wanted to find a solution that will let him convert one text with users list (string) into many elements (array).

This smart guy knew about the Powershell Split method. One thing he had to do was find specific characters (delimiter) to define in this method. 

Bob has started to try the Powershell Split method. He divided ‘Abcde‘ string by ‘c‘ delimiter, and he received an array with two elements: ‘ab‘ and ‘de‘.

Powershell split simple example

Bob has read the method documentation on the website, and he found that to divide text (string) in every new line, he has to use ‘`n‘ delimiter.

That was it!!!

Powershell split user list

As you can see, Bob found the solution to his problem. Now he can paste users list directly into Powershell console and use it in the foreach loop. He saved time because he doesn’t need to create CSV files every time, he received new similar requests.

Do you know similar tricks in Powershell?

Get Access to Poshland Resources for FREE!!!

Signup now and receive an email once I publish new content.

I agree to have my personal information transfered to MailerLite ( more information )

I will never give away, trade or sell your email address. You can unsubscribe at any time.