Auditing: Format Active Directory Email Addresses

Perhaps this is just my own OCD but I think email addresses should all be formatted in the same way in active directory but inevitably some will put john@company.com and others will put John@company.com and all variations in between. 

The below can be run to fix the formatting as you like it and will change all email addresses to your desired format.

$users = Get-ADUser -filter * -Properties name,samaccountname,mail  | Select-Object name,samaccountname,mail
foreach ($user in $users) {

    $Name = $user.name
    $UserID = $user.samaccountname
    $Email = $user.mail
    $NewEmail = (Get-Culture).TextInfo.ToTitleCase("$email")
try {
set-aduser $UserID -EmailAddress $NewEmail 
}
catch {write-host "The email field for $Name is blank" -ForegroundColor Red}
}
$users.Count

Function: Internet Radio Control – Frontier Silicon

The below uses the PowerShell invoke web request cmdlet to control a Roberts Internet Radio using the Frontier Silicon API. I have tied this in with my home automation to turn the radio on and off as feedback what is playing.

 

 


Read more “Function: Internet Radio Control – Frontier Silicon”

Auditing: Report and Disable Inactive AD User Accounts

The below can be run as a scheduled task to detect and disable accounts that have not been used for a specified amount of days or for accounts which have never been used.

Report outputs to a CSV and is displayed as follows:


Read more “Auditing: Report and Disable Inactive AD User Accounts”

Auditing: Reset Passwords That Expire Today

The below can be run as a scheduled task to detect Active Directory User accounts that have passwords that expire today. Any objects where the password is due to expire today will automatically have the “Change password at next logon” ticked meaning that they wont suddenly lose connection to things such as mapped drives at the original expiry time.

Credit to Andrew Lyonette for turning my “Why dont you solve it like this” in to the script below.
https://www.linkedin.com/in/andylyonette/


Read more “Auditing: Reset Passwords That Expire Today”

Auditing: Report and Disable Inactive AD Computer Accounts

The below can be run as a scheduled task to detect and disable accounts that have not been used for a specified amount of days or for accounts which have never been used.

Report outputs to a CSV and is displayed as follows:


Read more “Auditing: Report and Disable Inactive AD Computer Accounts”

Auditing: Audit AD Groups

This script will perform AD group member auditing by fetching all AD Groups and their members and then email the owner of that group a list to be checked to ensure they are still correct.

It utalises the Description field for the group name e.g Sales File Share or Sales Distribution Group and the MangedBy property to then fetch the owners name and email address from the Mail field of the user.

For any group that does not have a ManagedBy user a separate email will be sent to an address of your choosing stating that there is no owner and to check the members and find an appropriate owner.


Read more “Auditing: Audit AD Groups”