Active Directory Health Check automation via Powershell

It’s important to run some Active Directory Health checks on your domain. To that end, I thought it would be great to generate a weekly report that contained a DCdiag, a Repadmin and Best Practice Analyzer report. This could be done via a Scheduled task. It could then run once a week and then email you with any issues. A great way to keep on top of the health of your environment and to make sure no little niggling errors are hiding just under the covers, waiting to destroy your environment.

The hardest part of the script was executing the cmd prompt command via the script. Passing in arguments is messy in Powershell at the best of times, but passing in arguments with spaces and having to escape the correct characters etc is very tedious. So, as a disclaimer, this script is a work in progress. It works, but by no means is it an example of Powershell Best Practice. (I’ll keep a tinkering on it, and if anyone has any suggestions please leave a comment.) Hopefully, though, someone other then me may find this useful.

There are also a few caveats to be aware of. This script, the way it is presented here, will only work on Powershell v3. I found this out because in an effort to get the BPA cmdlets working, I realized that the syntax for the commands are different in the different versions of Powershell. If you would like to get this to work on Powershell v2, you just need to change the -ModelID parameters to -ID. A quick “Get-Help Invoke-BPAModel” should sort that out pretty swiftly. Also, the file locations are hard coded at this point.

You can find some more information about DCDiag command here.
You can find some more information about the Repadmin command here.
Here is some information aswell about running the BPA via Powershell

Google Sync IOS Exchange - Not Working after January 30, 2013

Due to Google's decision to stop new users using Google Sync IOS Exchange Syncing after January 30, 2013, some of you may be looking for a way to sync your contacts with IOS. I got a new phone today, and in the course of setting it up, realized that my Mail and my Contacts weren't syncing correctly. After owning IOS devices since the Iphone 3G and Ipad 1, I've grown accustomed to the old way of using Google Sync IOS / Microsoft Exchange ActiveSync Protocol to sync up my Contacts, Gmail, and Calendar etc. Up until now however, I never heard of Google pulling this functionality. (I need to keep up with the tech blogs a bit more methinks!) It was only when I re-entered my application specific password for the 5th time, and quadruple checked my settings that I thought, hang on, perhaps some sort of shenanigans are a foot. That's when I stumbled across this link on the Google Support Website. Shenanigans INDEED!

Long story short, even though we might not be able to use Google Sync IOS Exchange syncing, the functionality is still there, it's just that you have to go about it a little differently. Let me show you.

Setting up Gmail, Calendar and Notes.

 

Open settings and then touch the Mail, Contacts, Calendars option.

Google Sync IOS Exchange Image 1

Now touch the Add Account option.

Google Sync IOS Exchange Not working Image 2

Select Gmail.

Google Sync IOS Exchange Not Working Image 3

Enter in the following details:

*** Please note *** - If you are using 2 step verification, you will need to generate an Application Specific password to use in the password field. You can generate an application specific password by going to your google account page, then selecting security, then selecting 2 Step Verification Settings, then selecting the Manage application-specific passwords hyper link.

Google Sync IOS Exchange Not working Image 4

Name

< Your Name >

Email

< your full email address e.g. [email protected] >

Password

< your password >

Description

< A relevant description.

 

Google Sync IOS Exchange Not Working Image 5

Wait for it to verify.

Google Sync IOS Exchange Not Working Image 6

Switch on/off what you would like to sync.

Google Sync IOS Exchange not Working Image 7

And then you are all done for syncing your Mail, Calendars and Notes.

Setting up Contacts

Go back in to Mail, Contacts and Calendars and setup another new account.

Google Sync IOS Exchange Not working Image 8

This time, we will select, Other.

Google Sync IOS Exchange Not Working Image 9

Select Add CardDAV Account.

Google Sync IOS Exchange Not Working Image 10

Enter the following details:

*** Please note *** - If you are using 2 step verification, you will need to generate an Application Specific password to use in the password field. You can generate an application specific password by going to your google account page, then selecting security, then selecting 2 Step Verification Settings, then selecting the Manage application-specific passwords hyper link.

 

Server

Google.com

User Name

< your full email address, e.g. [email protected] >

Password

< your password >

Description

< A relevant description >

 

Check to make sure the account details are verified.

Now you should see your Contacts appear in the Contacts section.

That's all there is to it. Hope this helps!

 

 

 

 

 

 

 

Hyper-V Error – An Authentication error.

Hyper-V Error – An Authentication error has occurred. The Local Security Authority cannot be contacted.

Today I was trying to connect to a Hyper-V Virtual Machine when I started to get this error on all of the VM's on that particular host. I was connecting to the Hyper-V host via a Windows 8 Workstation via the Hyper-V Manager.

At first I thought it was an issue with my account, but it wasn't. After hunting around for ages and running out of ideas, I stumbled across the obvious. The Hyper-V host didn't have the correct DNS servers set.

So I changed the DNS Servers to the correct ones that were being used in my Domain and bob was my uncle!

 

Hope this helps!