Showing posts with label AD. Show all posts
Showing posts with label AD. Show all posts

Wednesday, May 28, 2014

Everyday Powershell - Part 23 - Check for old servers

Another simple AD cleanup script. But it's the simple things in life that count right?

You can run this script and it'll find any servers in your domain. It pings them and if they reply it sets .there to true otherwise it'll be null.
$servers = Get-ADComputer -filter {OperatingSystem -like "*Server*"}
$report = @()
foreach ($server in $servers)
{
    $temp = "" | select Name, There
    $temp.name = $server.DNSHostName
    $temp.there = if(Test-Connection $server.DNSHostName -Count 1){$true}
    $report += $temp
}
$report

Quick and dirty powershell to do something useful in a hurry. That's what we're all about here!


Wednesday, May 14, 2014

Everyday Powershell - Part 21 - List Mailboxes with disabled user accounts

Any organisation will have users coming and going all the time. As admins we've got to manage much of this process. Running regular reports like this can catch errors in onboarding and offboarding processes.

Add-PSSnapin *exchange*
Get-Mailbox | Get-aduser -identity {$_.samaccountname} -Properties enabled | where {$_.enabled -eq $False} | Select Name

Very simple one liner script that'll list all mailboxes that have their associated users account disabled.

You could package this up into an email and send that to the relevant people on a regular basis.

Ahhh using Automation to make your team look more professional... Is there anything more rewarding?