Have you ever found yourself needing to edit a long list with usernames, and you had to go in and manually clean that list up, format it properly, wrap it in quotes and so forth? Yeah, it’s painful, but I finally found this handy regex statement that makes it all better.

So let’s take we have a regular user list

After running the regex, we have them all neatly wrapped in quotes

Now we have this nice list, but let’s say we need that as a string in a line. regex? Yeah no problem!

Oh so handy, hope it saves you some time!

EDIT:

Adding another, removing blank lines in a script

Replace this with nothing to remove all empty lines. :¬)

I wanted to append information to the verbose output of a cmdlet so that logging is neater. Well, it seems there is no nice way to do that?

This is what I came up with, redirecting the verbose stream, manipulating the verbose string, and then write it verbose back out

Source: https://blogs.technet.microsoft.com/heyscriptingguy/2014/03/30/understanding-streams-redirection-and…

You might not even notice until you need it, but when you install the RSAT tools on Win 10 for 1709, the DNS manager console is missing. That’s exactly what happened to me. I needed to add some records in DNS and oops, where is it?

Well, there is a KB article on it, so there is a fix. :¬)

  1. Check if KB 2693643 is installed, if so uninstall it
  2. Create a temporary directory to put stuff in it
  3. Create a “installx64.bat” file with the following content: [assuming you run a 64 bit Windows]

    4. Create a “unattend_x64.xml” file with the following content:

    5. Download the RSAT tools and put the msu file in the same folder

    6. Start a command prompt with administrative permissions and run the “installx64.bat”

    Once completed, you should have your full set (including DNS) of RSAT tools back

    Resource: https://support.microsoft.com/en-us/help/4055558