Office 2010 cmd activate or change product key

Yes it’s 2020 and we’re still messing around with Office 2010! If you’re having issues with license keys not working, activation problems etc then here’s a few useful commands.

Activate Office

Open CMD as Administrator.

cd c:\Program Files (x86)\Microsoft Office\Office14
cscript ospp.vbs /act

Change Product Key

cscript ospp.vbs /inpkey:XXXXX-YYYYY....

Connect to VPN from desktop in Windows 10

  1. Right click the Desktop and select New – Shortcut.
  2. In the shortcut target box, type or copy-paste the following command:
    rasphone -d "VPN connection name"
  3. Set the desired icon and name for your shortcut.

Once you do this, just click this shortcut to connect to a VPN directly. You can pop it anywhere you wish. To disconnect you can do the same but use the following instead…

rasphone -h “VPN connection name”

Outlook won’t accept “app password” after setting up MFA

So we use Exchange Online Plan 1 and Outlook 2016. After setting up Multi-factor Authentication for one of my email accounts I found that after a couple of days Outlook started popping up the password prompt for the account.

No matter how many times I tried it wouldn’t accept the “app password” i created here or the normal password for the account. After a bit of digging I found this article which suggested adding the following registry key which solved the problem for me.

dword value 1

Export all AD groups and their members to CSV file

Export all Active Directory groups, the group category, group scope and all group members to a CSV file. Active Directory PowerShell module is required. Tested on Windows Server 2012 R2 and Windows Server 2016. Amend $DateTime variable format and $CSVFile for path and filename.

#// Start of script 
#// Get year and month for csv export file 
$DateTime = Get-Date -f "yyyy-MM" 
#// Set CSV file name 
$CSVFile = "C:\AD_Groups"+$DateTime+".csv" 
#// Create emy array for CSV data 
$CSVOutput = @() 
#// Get all AD groups in the domain 
$ADGroups = Get-ADGroup -Filter * 
#// Set progress bar variables 
$tot = $ADGroups.count 
foreach ($ADGroup in $ADGroups) { 
    #// Set up progress bar 
    $status = "{0:N0}" -f ($i / $tot * 100) 
    Write-Progress -Activity "Exporting AD Groups" -status "Processing Group $i of $tot : $status% Completed" -PercentComplete ($i / $tot * 100) 
    #// Ensure Members variable is empty 
    $Members = "" 
    #// Get group members which are also groups and add to string 
    $MembersArr = Get-ADGroup -filter {Name -eq $ADGroup.Name} | Get-ADGroupMember | select Name, objectClass, distinguishedName 
    if ($MembersArr) {  
        foreach ($Member in $MembersArr) {  
            if ($Member.objectClass -eq "user") { 
                $MemDN = $Member.distinguishedName 
                $UserObj = Get-ADUser -filter {DistinguishedName -eq $MemDN} 
                if ($UserObj.Enabled -eq $False) { 
            $Members = $Members + "," + $Member.Name  
        #// Check for members to avoid error for empty groups 
        if ($Members) { 
            $Members = $Members.Substring(1,($Members.Length) -1) 
    #// Set up hash table and add values 
    $HashTab = $NULL 
    $HashTab = [ordered]@{ 
        "Name" = $ADGroup.Name 
        "Category" = $ADGroup.GroupCategory 
        "Scope" = $ADGroup.GroupScope 
        "Members" = $Members 
    #// Add hash table to CSV data array 
    $CSVOutput += New-Object PSObject -Property $HashTab 
#// Export to CSV files 
$CSVOutput | Sort-Object Name | Export-Csv $CSVFile -NoTypeInformation 
#// End of script

Original article found here

Office 2019 Install

Download & Install Office 2019

Open command prompt with admin rights and type

cd /d %ProgramFiles%\Microsoft Office\Office16


cd /d %ProgramFiles(x86)%\Microsoft Office\Office16

then each of the following lines individually

for /f %x in ('dir /b ..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%x"
cscript ospp.vbs /setprt:1688
cscript ospp.vbs /unpkey:6MWKP >nul
cscript ospp.vbs /inpkey:NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP
cscript ospp.vbs /
cscript ospp.vbs /act

Outlook 2010, 2013 & 2016 Wont Archive Emails Fix

Outlook will not let me archive old emails to a .pst file. The reason I want to do this is to free up space in my exchange online mailbox as it’s nearing it’s limit. I can tell it to do an archive, specify a date etc but it does nothing and all the old emails I told it archive are still there.

Outlook for some reason decides to archive based on modified date not sent or received date that you would expect. To remedy this you must first make sure that if you are using Outlook 2010 then you have applied the following hotfix first (not needed for 2013 or 2016) then add the following entry to the Registry.

Key for Outlook 2010: 
Key for Outlook 2013: 
Key for Outlook 2016: 

Value name: ArchiveIgnoreLastModifiedTime
Value type: REG_DWORD
Value: 1

You must restart Outlook after you add the ArchiveIgnoreLastModifiedTime registry.

Archiving should now work as expected.

How to Check Index Fragmentation on Indexes in a SQL Database

Firstly I would like to point out that the following article was copied from here so all credit goes to them. I found it while tying to find out why one of our databases was incredibly slow!


SQL Queries taking longer than normal to complete.


SQL Server 2005, SQL Server 2008 R2, SQL Server 2012, SQL Server 2014, SQL Server 2016

When a database is frequently updated via INSERT, UPDATE, or DELETE statements we can expect it to become fragmented over the time.

If database indexes are fragmented, the SQL Server query optimizer may chose a non-optimal execution plan when using an index to resolve a query.

This will affect the overall query performance and you may notice a query behaving slower than normal.


**Warning: Irreparable database damage can occur. This procedure should only be performed by users familiar with SQL Server Management Studio. Databases should be backed up prior to performing this procedure.**

The following is a simple query that will list every index on every table in your database, ordered by percentage of index fragmentation.

SELECT dbschemas.[name] as 'Schema',
dbtables.[name] as 'Table',
dbindexes.[name] as 'Index',
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS indexstats
INNER JOIN sys.tables dbtables on dbtables.[object_id] = indexstats.[object_id]
INNER JOIN sys.schemas dbschemas on dbtables.[schema_id] = dbschemas.[schema_id]
INNER JOIN sys.indexes AS dbindexes ON dbindexes.[object_id] = indexstats.[object_id]
AND indexstats.index_id = dbindexes.index_id
WHERE indexstats.database_id = DB_ID()
ORDER BY indexstats.avg_fragmentation_in_percent desc

This query can be modified to focus on specific tables by append the table name to the ‘where’ clause:

WHERE indexstats.database_id = DB_ID() AND dbtables.[name] like '%%'

In order to reduce fragmentation we will have to reorganize or rebuild the indexes. Choosing between reorganizing or rebuilding depends on the query results.

For heavily fragmented indexes a rebuild process is needed, otherwise index reorganisation should be sufficient.

The following info summarises when to use each one:

Reference Values (in %): avg_fragmentation_in_percent > 5 AND < 30
Action: Reorganise Index

Reference Values (in %): avg_fragmentation_in_percent > 30
Action: Rebuild Index

In my case I then did the following…

DECLARE @fillfactor INT
SET @fillfactor = 80
SELECT '[' + OBJECT_SCHEMA_NAME([object_id])+'].['+name+']' AS TableName
FROM sys.tables
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName
SET @sql = 'ALTER INDEX ALL ON ' + @TableName + ' REBUILD WITH (FILLFACTOR = ' + CONVERT(VARCHAR(3),@fillfactor) + ')'
EXEC (@sql)
FETCH NEXT FROM TableCursor INTO @TableName
CLOSE TableCursor

Learn morse code the easy way

I stumbled across this nifty little Morse code learning tool today whilst browsing the Experiments with Google site. I know what you’re thinking… “why do i need to learn Morse code”? Well… it’s highly unlikely that you would ever need to know, but the idea behind this trainer is to make learning Morse code fun and encourage people to keep at it.

Why not give it a try… 

Publish current files shortcut key Visual Studio 2017

I know this is unbelievely basic but to publish the currently selected file in Visual Studio 2017 whether it’s the current file you’re working on or one you have selected in the solution explorer all you have to do it press the following…

Hold Alt, then press ; then press P

The reason for this post is that Visual Studio displays the shortcut key as Alt+;,Alt+P which I found a bit confusing and after a bit of ‘googling’ I found that many others out there thought the same too!

Stop Windows Server 2012 from automatically restarting after login

Let’s imagine… you’ve just logged in to your server and you are presented with “Your PC will restart in 15 minutes”. In some cases, this may cause you to panic, especially if you know the server is being used by lots of “important” users.

Fortunately there is a quick fix for this to stop the countdown and avoid a reboot.

  1. Open an Administrative command prompt.
  2. Type NET STOP WUAUSERV to stop the Windows Update service.

This will stop the windows update service and stop the countdown timer until the server is rebooted manually at a more convenient time.

P.S. If you are reading this article you may already have found people suggesting you type “shutdown -a” from a command prompt. This does not work!