PowerShell Notes

Split Operator: http://ss64.com/ps/split.html

Trim Operator: http://ss64.com/ps/trim.html

If you have a string and need to carve it up, you can use the .split() operator



Now what if you need to grab only the 2nd word in that string.  By default the .split() operator will carve up the string by spaces.

To grab the 2nd word thus grab the word “HELPS” we can use the below.  Remember the string starts at 0

2This is all good but what if there was a space before or after the word “Helps” that we have now stored in our variable $SECONDWORD.  To account for this we can add a little bit of extra code to ensure that all white spaces are removed.


Because we added .Trim() we will ensure that there are no white spaces.


Install telnet client

Add-WindowsFeature telnet-client

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s