Powershell : Query for user’s last logon date

I needed to work out some AD accounts’ last logon dates to make a further assessment, in powershell I found this was fairly simple:

To get a list of all user attributes available for query:

$> get-aduser -identity <USERNAME_HERE> -Properties *

To query for last logon date:

$> get-aduser -identity <USERNAME_HERE> -Properties LastLogonDate


Microsoft Office 2016 Licensed via KMS but with Activation Splash Screen on launch

Resolved by following https://support.office.com/en-us/article/Office-repeatedly-prompts-you-to-activate-on-a-new-PC-a9a6b05f-f6ce-4d1f-8d49-eb5007b64ba1



  • Close the activation window and all Office apps.

  • Right-click the Start button Windows Start button in Windows 8 and Windows 10 on the lower-left corner of your screen, and select Run.
  • Type regedit, and then press Enter. Select Yes when prompted to open the Registry Editor.
  • On the left side of the Registry Editor, under Computer, navigate to the following key in the registry:


  • Right click the OEM value and click File>Export.
  • Save the key.
  • After the key is backed up, select Edit>Delete.
  • Repeat steps 3-6 for the following key:


  • Close the Registry Editor and start Office again.


Windows 7 Boot Sector Repair

The Scenario

I was working on a dual booted MBR style disk which had Windows 7 and Ubuntu installed. I was asked to remove the Ubuntu partition(s) and extend the Windows partition. The user had a backup of all data from the Ubuntu partition, not the Windows. The GRUB boot loader was in operation.

The Solution

I began by backing up the disk.

I then booted into Windows and inspected the disk partitions via Disk Manager and (thankfully) found that Windows had been installed first, shrunk and then Ubuntu installed. This was apparent by seeing the order of partitions on the disk from left to right. I then deleted the 2 Ubuntu related partitions at the end of the disk (both were present after the Windows OS partition) and extended the Windows partition into the recovered space.

Then I rebooted into a Windows Recovery environment via a USB install I’d been supplied with and let Windows attempt a start-up repair, that failed and no valid Windows partitions were displayed, which might be normal if GRUB is controlling the bootloader but I’d have expected Windows PreInstalled Environment to detect the local partition.

I then opened a command prompt and ran the following commands:

bootrec /fixboot

-This ran successfully

bootrec /fixmbr

-This failed to complete, unable to find device or somesuch

bootrec /rebuildbcd

-This failed, it was unable to write to device

I spent a good hour attempting to manually rebuild the bootloader via bcdedit commands which eventually failed until I came across a thread suggesting the issue is booting from Windows 7 USB media.

I then dug out an old Windows 7 DVD and booted from that and voila, the above commands worked successfully. I did have to trash c:\boot\BCD via the commands:

attrib c:\boot\bcd -s -h
move c:\boot\bcd bcd.old

and then set the OS partition (no 100MB System partition on this disk) to active before running them successfully. I also then launched the Windows Startup Repair from within the DVD repair tools to correct any faults with active partitions etc. Following that the system booted.

Hope this helps someone, what should have take 15 mins ended up taking me 2 hours!

Intel Network ProSet Fails to Uninstall

I recently struggled to upgrade my Intel(R) Network Connections driver installation from v22.4.10 (unsupported in Windows 10 1703) due to a corrupted uninstaller.


When attempting to install the latest supported driver (v22.6.6.0) the installer attempts to call any currently installed versions’ uninstaller and then fails with error 1703.


After much reading up I came across this post from days gone by referring the the last nuclear approach of MZIZAP https://blogs.msdn.microsoft.com/ronalg/2012/06/07/troubleshooting-msi-uninstall-issuesintel-pro-network-connections-1713/ .
That led me to search for modern alternatives which led me to the Windows 10 Helper utility https://support.microsoft.com/en-gb/help/17588/fix-problems-that-block-programs-from-being-installed-or-removed

Launching that and first running it to repair the uninstaller and then again to forcibly remove it did the trick, I was then able to install the latest version.


I hope this helps someone else.

Subinacl.exe Microsoft Service Permissions

A nice little tool to manage service permissions on Windows name subinacl is available at https://www.microsoft.com/en-gb/download/details.aspx?id=23510

Default install directory is “C:\Program Files (x86)\Windows Resource Kits\Tools”
Usage example for the ‘spooler’ service and the user domain\username:

subinacl /service spooler /grant=domain\username=top



xcopy /C/H/R/S/Y c:\ d:\

/C = Continues copying even if errors occur
/H = Copies hidden and system files also
/R = Overwrites read-only files
/S = Copies directories and subdirectories
/Y = Overwrites existing files without asking


robocopy c:\ d:\ /MIR /R:0 /W:0

/MIR = Mirror entire directory structure (can use /E instead)
/R:0 = 0 retries for read/write failures
/W:0 = 0 seconds between retries

Credit to: https://djlab.com/2010/12/windows-ignore-errors-with-xcopy-and-robocopy/

Microsoft WSUS Rebuild

To re-install WSUS with a clean database i.e. no previous configuration:

Run Windows Powershell as Administrator and use the following commands:

  • Uninstall-WindowsFeature -Name UpdateServices,Windows-Internal-Database -Restart


  • Post restart, delete EVERYTHING in the C:\Windows\WID\ (for Win 2012 r2) folder.


  • Then run the following command to re-install WSUS:
    Install-WindowsFeature UpdateServices -Restart


This only works on PowerShell 3 or higher.


I had to run the postinstallation tasks manually via Powershell using the WID db, if using SQL you need to add in sql_instance=

C:\Program Files\Update Services\Tools\WsusUtil.exe content_dir=”<<dir of update download location>>


creds: https://serverfault.com/questions/449914/how-to-completely-wipe-wsus-and-start-again

Windows 10 Disable Cortana

Either through GPO :

Computer Configuration > Administrative Templates > Windows Components > Search

Allow Cortana = DISABLED


Or via the registry directly (always backup first – http://www.davegernon.co.uk/techblog/export-windows-registry/)


Create a DWORD-32Bit Value named and value:


Windows Software Won’t Uninstall – Reboot Required Despite Rebooting

If this problem happens then it may be a result of failing pending changes to the Windows OS. These file changes are listed in a registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\

under DWORD:


I would suggest first renaming this DWORD value, with the prefix “OLD_” or something similar and then attempting the un/install again.

If there were some unexpected results in renaming the file it is trivial to remove the prefix and restore the system but best practice would include an entire registry export prior to fiddling!

Export Windows Registry