Words about things. Introverted, Geeky, SysAdmin.

SysInternals Updater


I was just running a delightful batch script written by Jason Faulkner to update my SysInternals tools directory.

Sysinternals Updater

It was taking forever! At least 2 seconds per tool (regardless of state), and a huge chunk of time to download the current tool list. It seems to download everything, regardless of whether or not it's up-to-date.

I thought it may be far quicker in PowerShell with some more up to date methods, so I sketched this out. It's far less robust (won't attempt to kill processes if they're in use), as I actually don't want that functionality.

function Update-SysInternalsTools {  
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        $localDirectory
    )
    begin {
        $localTools  = Get-ChildItem $localDirectory -Filter *.exe
        $onlineTools = Get-ChildItem '\\live.sysinternals.com\tools' -Filter *.exe
    }
    process {
        foreach ($tool in $localTools) {
            if ($tool.LastWriteTime -lt ($online = $onlineTools | ?{$_.Name -eq $tool.Name}).LastWriteTime) {
                Write-Verbose "[$($tool.Name)] requires updating..."
                try {
                    Invoke-WebRequest -Uri $online.FullName -OutFile $tool.FullName -ErrorAction Stop
                }
                catch {
                    Write-Warning "$($tool.Name) failed to update."
                }
            }
        }
    }
}

if ($MyInvocation.InvocationName -NE '.') {Update-SysInternalsTools}  

I'll probably update the script shortly with kill-process-and-restart as an option (as well as a "download everything" argument, as it currently only updates tools that are present), but it seems to get through the listing far faster.

It's also currently just comparing LastWriteTime - it could actually grab the VersionInfo/FileVersion with Get-ItemProperty, but I thought that might add a very large chunk of (fairly unnecessary) delay. Will have to test it.

Google Chrome allows Tab-by-Tab muting


Was just going to re-enable NPAPI plugins in Chrome, and I found this:

chromeflags-tabaudiomute

Now that's cool! Slightly weirdly, I love exploring the about:flags page in Chrome (Canary, or otherwise) and finding things in various stages of development - and I always loved the functionality that allowed you to see which tab was playing audio.

On hover:
chromeflags-tabaudiomute-mouseover Context Menu:
chromeflags-tabaudiomute-contextmenu

Active Directory - Storing Bitlocker Recovery Info


A recent quick project was to enable storage of Bitlocker recovery data within Active Directory, instead of our moderately secure encrypted drive of text-files.

This is actually a really easy process (assuming you only have Windows 7 / 2008R2 and up on the domain), only needing to make a few adjustments to ACLs on ADComputer objects (allowing Computers to write to their own objects).

The Technet article describing this, along with the more convoluted method involved in sorting this out for anything below 2008R2 is here: Backing Up BitLocker and TPM Recovery Information to AD DS

Unfortunately, it's a bit of a hassle (very minor hassle, anyway) to load up ADSIEdit.msc, and navigate around to the correct object every time you want to retrieve a key... so I wrote a quick Powershell script to replace the VBScript linked in the above article.

param(
    [Alias("Computer","Name")][string[]]$Computers,
    [Parameter(Mandatory=$true)][PSCredential]$Credential
)

function Get-BitlockerRecovery($Computers, $Credential) {
    $report = @()

    foreach ($Computer in $Computers) {
    $objects = Get-ADObject -Filter * -SearchBase (Get-ADComputer $Computer).DistinguishedName -Credential $Credential -Properties * | Where -Property ObjectClass -eq msFVE-RecoveryInformation

    foreach ($key in $objects) {
        $keyInfo = "" | Select Computer, RecoveryID, RecoveryPassword
        $keyInfo.Computer = $Computer
        $key.Name -match ".*\{(.*)\}" | Out-Null
        $keyInfo.RecoveryID = $matches[1]
        $keyInfo.RecoveryPassword = $key."msFVE-RecoveryPassword"

        $report += $keyInfo
        }
    }
    return $report
}


Get-BitlockerRecovery -Computers $Computers -Credential $Credential

I'm sure there's probably a nicer way to do it, and that this could be compressed down to three lines or so - but I think that's quite legible.

Sunday Bike-Ride (08/06/14)


Nice ride! Managed to miss my Dad at Gransden, Orwell, and Barrington, but otherwise lovely.
Also to note: The Royal Oak in Barrington stops serving drinks at 15:00. What the what!?

Streaming - Payday 2



Watch live video from Jinoxide on TwitchTV

I've been playing plenty of Payday 2 with the Playstuff gang recently - it's in vogue, after some great updates, publicity and trailers. Anyway, I thought I'd stream some of it.

I'd recommend watching the recent "Dentist" trailer, starring Giancarlo Esposito (recently Gus Fring, of Breaking Bad) plays an excellent shady dentist chap - and doing some of the best DLC / mid-term plan reveals I've seen in a pretty low-key released PR video.

Also the wonderful "Big Bank" trailer - which I really enjoyed. Both are embedded below.


Watch_Dogs - _Role Model


Watch_Dogs

I've quite enjoying Watch_Dogs, playing it a little every few nights - it's not the new best thing since sliced bread, but it's quite interesting. I'm slightly disappointed by a lot of things in it - punishing damage in gunfights mixed with little to no downsides to anything relating to vehicles (beyond the driving model), boring and unvaried hacking minigames in a game that headlines "hacking", and a bit of a fluffed intro where you seem to get all the items from the start and then "get" them for the first time throughout the game.

One of the things I've been really bemused about is the annoyingly forced mission _Role Model, which I've just played today. Some spoilers follow, and I'll probably refer to it all fairly casually - as if you knew enough to be spoiled, really.

Objective: Kill 'em All

It'll surprise noone who knows me that I've been playing Watch_Dogs so far fairly quietly - only really killing when I really need to. I love the way that the vigilante/alignment meter seems to reel in the tendency among folk to drive around manically, running down countless faceless civilians.

There have been a few missions that require you kill enemies - mainly gang-members, or mob affiliated goons. Sure. There are a lot of weapons in the game, I do wonder if I should be playing it slightly more trigger-happily - but I've enjoyed the choices provided.

Until this mission.

Spoilers begin here.

The mission begins with Jackson (or "Jacks", the protagonist's nephew), going missing from his current hideaway. You, as the player, are then prompted to go and find him. You locate him (fine, done that before), travel to the location (yep), and are told to kill a moderately large amount of enemies.
No choices, no sneaking, no clever hack-around solution.

Slaughter them. Oh, and wipe out the reinforcements, when they inexplicably arrive (I managed to kill them all quietly, without any alerts or enemy shots fired).

That's all fine - I'm great at this!

You then go up to "rescue" Jacks to find that he's seen all of the bodies, is terrified of you, and is judging you - which I'd probably be fine with, if I'd had a choice.

I guess it's going to become obvious why, in future play (and will probably contribute wonderfully to Aiden's relationship with his sister), but it really grates after so many brilliant games that allow you the choice of killing or not. I suppose I was hoping for something similar here.

Sunday Bike-Ride (18/05/14)


Thanks to Fergus for putting up with me - turns out, I'm awful at hills.

cycleroute-180514

I had a lot of fun, though, and was convinced of the necessity of cycling gear. I was going to get one of the r/Cycling jerseys, but shipping is half the cost of the item... plus I think I prefer last years version.

2013Jersey 2014Jersey

What do you think? Both quite nice, I agree.

Weight, what?


Weight = Some

To this end, do I really need a wi-fi enabled weighing scale?

fitbit aria

This simple-looking device will apparently do interesting things like "recognise me", and "weigh me", and "wirelessly upload my current weight and fat/body ratio to the vast pool of data known as the internet".
It does cost roughly ten to fifteen times what a regular electronic scale does, though, and probably two to three times an electronic scale with fat-measuring-tech.

I probably do need some scales, as being without any at all is affecting my ability to judge myself. And the gap between some and scales there is reminding me of a great sub-reddit - r/Keming. Curiously this font doesn't lend itself to that joke.

So anyway, I'm tempted to use some John Lewis vouchers I found buried under letters and manuals near my desk to get either a FitBit or Jawbone Up24 or something... Does anyone have any recommendations? Alternatively, I might subscribe to the Gym, which is all of 30 seconds away. Adult life, eh?

Edit: I've found that neither Fitbit nor Up nicely support cycling, so I'm entirely unsure what to do... but I'll probably do nothing. So no worries!

PoSH Fun


I was browsing r/Powershell (as you do), and noticed a chap complaining about the test at the end of a course, where he was asked to

Create a directory named "newdir" in every empty directory whose name is longer than 8 characters recursively.

His code went like this:

$currentdir=pwd;
$array=@()
get-childitem -recurse | where{$_.Mode -like "d*"} | foreach-object         {$array+=$_.FullName;}
$size=$array.Length;
for($i=0; $i -lt $size; i++)
{
if($array[$i].Length -gt 8)
{
cd $array[$i];
mkdir newdir;
}
}
cd $currentdir;
echo "Done"    

I've been pushing to go on a decent Powershell course for a while, but I think I'll need to pick another course, as I'm sure I can do something more PS specific. Let's have a go...

Though I did miss one requirement (only create files in empty directories), I began with this:

$targetdir = C:\Users\James\Work\Powershell\
$dirs = @()

gci $targetdir -Recurse -Directory | %{ 
    if(($_.Name).Length -ge 8){$dirs += $_.fullname}
}
$dirs | %{ mkdir (Join-Path $dir "newdir")}

Of course, changing that last line to a quick check solves the empty folders issue -

foreach ($dir in $dirs) {
    if (!(gci $dir)) {mkdir (Join-Path $dir "newdir")}
}

I do realise that I'm cheating a bit - apparently he was only using stuff available in Powershell 2.0 (poor chap), so the -Directory argument for GCI was unavailable.

Please also note, @stuidge, that Powershell is capable of more fun things, but I'm lazy (and I'd written this out for a reddit post last night... then not posted it, then rewritten it briefly for this).

Soundcloud


Mashups, mixes, and more - Soundcloud hosts a bizarre amount of great music, and pops up in a lot of the places I go searching for streamable tracks at odd times.

My account on Soundcloud is Jinoxide, and I occassionally reshare or like stuff - here's a playlist of stuff I've apparently enjoyed.