DuPSUG Basics – Deux

Today was another great day with other PowerShell enthousiasts where I got to share some tricks of the trade.

During DuPSUG’s second Basics event, I was once again able to provide a session, this time about “Improving your Scripts”.

I had a blast and I hope others did too and as promised I’ve made my code available on GitHub on the general DuPSUG GitHub.

 

I’d like to thank all the people attending today’s session for your time and patience, all other speakers for sharing their time, code and tricks and of course @EJHeeres for arranging the event perfectly.

Hope to see you again soon and happy scripting! 🙂

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Script Dumpster: Find duplicate entries over multiple reports

Another day at the office..

Thanks to our friends who wrote the NotPetya worm, I received an email from our monitoring vendor to run reports to see if our machines are up-to-date on their patching.

Unfortunately their reporting tool doesn’t properly distinguish between Windows Server 2008 and Windows 2008 R2, as well as Windows 2012 and Windows 2012 R2.

Long story short,  I had to create 4 separate reports, telling me if I had or had not installed the proper KB item on each machine.

Because of this flaw I also had to join the reports and check the “Highlight Duplicates” option in Excel to see whether or not servers had their respective Hotfix installed (if the server had a duplicate entry, it meant that it didn’t have either the standard or R2 patch installed, meaning vulnerable).

Each report also came with a 3 row header with random junk that needed to be removed, so a simple Ctrl + A , Ctrl + C, Ctrl + V wouldn’t suffice.

PowerShell to the rescue!

I looked at the email from the vendor and went “Hell no, I’m not going to do that…” and opened up PowerShell ISE.

Having dumped the reports in the folder c:\Temp\NotPetya , I came up with the following script:

While the coding took a little bit longer, the execution was swift and perfect.

Geeks and Automation

 

Happy scripting! 🙂

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Script Dumpster: Copy your MDT Task Sequence

Ever have a Task Sequence in MDT which you customized and configured to use a specific driver profile, then having to create a second one just for another model and you have to copy everything over?

Well, I did and didn’t like it.

So according to Johan Arwidmark [if you’re into MDT and don’t already know this guy, get to know him!], this is possible in various ways.

Now while I used his approach, I didn’t like the fact that it wasn’t easily re-usable and I still had to provide various data myself.
And I’m lazy, so I don’t want that!

As mentioned in my previous MDT related post, do note that I have 2 important variables [MdtDrive & MdtRoot] configured within my PowerShell profile on my MDT server, so please make sure to also predefine these to use the script.

Happy Scripting! 🙂

Facebooktwittergoogle_plusredditpinterestlinkedinmail