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!


Tuesday, May 27, 2014

Oh Irony

Crash reporter crashed would you like to report this crash?


It's stuff like this that makes working in IT a comedy gold mine for those working in IT.

Wednesday, May 21, 2014

Everyday Powershell - Part 22 - Determine which mailboxes a user has fullaccess to

Had cause this week to figure out to which mailboxes a particular user had been assigned Full Access  permission.

Seemed a bit daunting, and would have taken us ages to audit just using the GUI. But it was actually very quick to get going in Powershell.
Add-PSSnapin *exchange*

$user = "TESTUSER"

$mailboxes = get-mailbox

foreach ($mailbox in $mailboxes)
{
    $mailboxpermission = Get-Mailboxpermission $mailbox
    foreach ($permission in $mailboxpermission)
    {
        $permission | where {$_.Accessrights -Contains "FullAccess" -and $_.user -like "*$user*"| select Identity
    }
}

This was a cracking use of Powershell right in the nick of time and made us seem really professional to our big boss. Really can't recommend enough getting some powershell tools into your frequently used toolbelt.

Once you start using it, it's amazing the things you start to dream up. Things you wouldn't have even thought to do before learning the power of the shell!

Friday, May 16, 2014

New rig is online!

Parts arrived by courier this morning...

Was planning to wait for the weekend to do the build. But being the passionate hardware enthusiast that I am, I couldn't wait. So I took a long lunch around at Kaggies shop and got to work.


The motherboard was in and out a few times to fit parts that I'd forgotten to mount. 


Doing the build in a proper work space was tops! Chris has all sorts of handy tools!


Mounting that water cooling system had me scratching my head for a while. Pretty sure I've done it wrong too. Might have a look a that manual again when I have a minute. I feel like there should be another Fan in the mix.


Builds always look so good right before the cables go in, don't they?


All done! All up it was about 2 hours including the Windows 8.1 install which was about 10 minutes! It's so fast and so Quiet. The Graphics card will change the sound profile quite a lot but we've got some plans for that too!







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?

Tuesday, May 13, 2014

New Rig Specs

So I'm building a new PC and decided to record the specs;

Fractal Design Define R4 Arctic White with Window
Gigabyte GA-Z97X-SOC Force LGA 1150 Motherboard
Intel Core i5 4670K Quad Core LGA 1150 3.4GHz CPU Processor
Corsair Vengeance Pro 8GB (2x 4GB) DDR3 2133MHz Memory
Samsung 840 EVO 250GB 2.5" SATA III SSD MZ-7TE250BW
Seasonic P-860XP Platinum Series 860W Power Supply
Thermaltake Water 3.0 Pro Liquid CPU Cooler
Gigabyte GeForce GTX 780 Ti 3GB WindForce 3X Video Card

It's going to be pretty special when it's done.

The CPU will be replaced by a Devils Canyon i7 once they become available.

It's my first foray into liquid cooling but using an all in one unit kinda makes it a more approachable concept.

Update! - Here are some photos from the build

Friday, May 9, 2014

Everyday Powershell - Part 20 - Rollback system time and launch a program

So there are times where loading an older application requires you to rollback the date of your system. Our UPS management console has had this odd requirement since 2014. So we threw this together to make life a little easier;

set-date 01/01/2009
Start-Process "c:\windows\system32\notepad.exe"
Start-sleep 15
set-date (invoke-command -ComputerName SOMECURRENTTIMESERVER -ScriptBlock {get-date})

You can update the process path in the second line, then save this as a .ps1 file and use it as a shortcut to launch time-bombed applications.

It does require the appropriate permissions on the sever we get the time from in the fourth line. It'll also need Powershell Remoting enabled.