So Long iPad….Hello Surface

I simply cannot believe that I am writing this, but as the title suggests I have ditched the iPad favouring the new Surface Pro 4….

I have been a serious Apple fan for many years, in fact I still am. I own a Mac Book Pro, iPhone, Watch and Apple TV and my family also own a range of Apple products-they are superb. However, I am a technical consultant that spends many hour travelling the UK meeting customers and generally fixing stuff. Up until recently I have relied on my trusty iPad Air 2 with the Logitech keyboard and of course the superb Office 365 services.

ipad surface

So why the change?

I specialise in all things Microsoft so Windows Servers, Office 365, Azure and also have been known to dabble in Networking and I simply cannot use my iPad for everything For example, if I go and see customers that don’t have wireless networks then I have no means of connecting to the infrastructure. I cannot create Powershell scripts and run them from my iPad, the biggy for me is the Outlook app. I run a small team of engineers and not being able to have true visibility of multiple calendars and business critical applications is a real problem. Don’t get me wrong, I will continue to adore my iPad, I continue to use it regularly for media and also for the range of excellent apps. I also fly drones commercially and the iPad comes in really handy for planning and controlling my drones.

Are there any downsides to the Surface?

Well like everything, you can’t have it all. With my iPad I was used to having a lovely 4g connection pretty much everywhere I went on the Three network. Unfortunately the Microsoft Surfaces do not have the ability to add a sim card for mobile data usage. – I guess I will just have to get used to tethering my device to my iPhone…

To Finish…..

The iPad and the Surface are both superb devices, and right now I am exceptionally lucky to own both of them, but for my professional career as much as it pains me to say this, the Surface gives me just that bit more flexibility to be able to do more aspects of my job. I am looking forward to seeing what 2017 brings in the world of technology, you never know, Apple may pull something out of the bag that yet again makes the iPad the weapon of choice.

PowerShell Script to List Active Directory Users & Last Logon Time

Occasionally there is a need to quickly query Active Directory for all user accounts or user accounts with only certain values in particular properties. This can be done by installing and loading the Microsoft Active Directory Administration module for PowerShell. This is an add-on module, named ActiveDirectory, that provides cmdlets that let you manage your Active Directory domains.

Below is a script I recently put together to produce a CSV File detailing the following:

Displayname – @{e={$_.properties.cn};n=’Display Name’},`

Username – @{e={$_.properties.samaccountname};n=’Username’}

LastLogonTime – @{e={[datetime]::FromFileTimeUtc([int64]$_.properties.lastlogontimestamp[0])};n=’Last Logon’},`

Account Disabled or Not – @{e={[string]$adspath=$_.properties.adspath;$account=[ADSI]$adspath;$account.psbase.invokeget(‘AccountDisabled’)};n=’Account Is Disabled’}

The Complete Script is below – Just copy and past the following into notepad, and save the file as filename.ps1

$NumDays = 0
$LogDir = “.\User-Accounts.csv”

$currentDate = [System.DateTime]::Now
$currentDateUtc = $currentDate.ToUniversalTime()
$lltstamplimit = $currentDateUtc.AddDays(- $NumDays)
$lltIntLimit = $lltstampLimit.ToFileTime()
$adobjroot = [adsi]”
$objstalesearcher = New-Object System.DirectoryServices.DirectorySearcher($adobjroot)
$objstalesearcher.filter = “(&(objectCategory=person)(objectClass=user)(lastLogonTimeStamp<=” + $lltIntLimit + “))”

$users = $objstalesearcher.findall() | select `
@{e={$_.properties.cn};n=’Display Name’},`
@{e={$_.properties.samaccountname};n=’Username’},`
@{e={[datetime]::FromFileTimeUtc([int64]$_.properties.lastlogontimestamp[0])};n=’Last Logon’},`
@{e={[string]$adspath=$_.properties.adspath;$account=[ADSI]$adspath;$account.psbase.invokeget(‘AccountDisabled’)};n=’Account Is Disabled’}

$users | Export-CSV -NoType $LogDir

How to Backup/Restore IIS7 & IIS8 Configuration

Backing up IIS7 configuration is as simple as copying the \windows\system32\inetsrv\config directory (and subdirectories) into a backup directory, so you don’t need anything special to do it.  Just include this directory in whatever your OS/content back-up plan is, or write a custom script to do it.

To help make managing backups easy, Microsoft added a simple cmd-line option to AppCmd.exe that makes management of backup/restore sets easy.  For example, to backup configuration, run the follow command:

> %windir%\system32\inetsrv\appcmd.exe add backup “My Backup Name”

to restore that backup, run this command:

> %windir%\system32\inetsrv\appcmd.exe restore backup “My Backup Name”

to delete a backup, run this command:

> %windir%\system32\inetsrv\appcmd.exe delete backup “My Backup Name”

IIS will automatically make history snapshots of ApplicationHost.config each time a change is detected, enabling you to easily restore to a prior version.  By default, IIS checks for a new version every 2 mins, and will keep 10 prior versions of the file.  IIS stores these snapshots in the %systemdrive%\inetpub\history folder by default.  You can change any of these settings by editing the section in ApplicationHost.config.