Check Microsoft office activation status using SCCM Compliance Settings

I did detailed blog post on 'how to get  office 365 proplus activation status' with help of extended MOF file and inventory changes. With this method ,you will get the activation details such as user email address, shared computer activation etc. For more information, please refer http://eskonr.com/2018/10/how-to-get-office-365-proplus-activation-status-and-excluded-apps-etc-using-sccm-configmgr/ .

This method requires extension of MOF files ,make changes to hardware inventory which will then create new SQL views . If you don't' want go through all these , but just looking for office activation status (yes or No) ,then this blog will help you to achieve it.

In this blog post, we will see how to detect office activation status (can be office 2010,2013,2016,office 365 proplus or office 2019) using Configmgr compliance baseline method.

Before we start looking into SCCM ,we need to check Microsoft office activation via script or other possible ways and then make use of ConfigMgr baseline?

From office 2007 until office 365 proplus/office 2019 ,there is vbs script called OSPP.vbs which is Office Software Protection Platform script (ospp.vbs) enables you to configure volume licensed versions of Office products. For more information ,please refer https://docs.microsoft.com/en-us/deployoffice/vlactivation/tools-to-manage-volume-activation-of-office

To check the status of any Microsoft office products ,we will use this vb script with parameter /dstatus (Displays license information for installed product keys) .

For office 2016 ,office 365 proplus the installed location is  C:\Program Files (x86)\Microsoft Office\Office16 (for x86).

I ran the command line cscript "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" /dstatus to see the activation status:

image

Any product that is licensed will display the status in LICENSE STATUS.

with this information ,we can create simple PowerShell script to check the license status and get the results .

How to create Configuration baseline and deploy:

In SCCM console, assets and compliance, click compliance settings ,configuration item create new configuration item.

image

Name it as Office activation and choose windows desktops and servers and click next

image

choose the list of client OS to asses the compliance . I choose all platform

In setting ,click New ,Type the name: Detect Office activation

Setting: Script

Data type: String

Add script:

I have added all versions of office products into the script with their default location. If you have changed the default installation location of office installation to something else ,you need replace the path.

Add the following script into discovery script.

# Check for  office 2007
if(Test-Path -Path "C:\Program Files (x86)\Microsoft Office\Office12\OSPP.VBS"){
   $status= cscript "C:\Program Files (x86)\Microsoft Office\Office12\OSPP.VBS" /dstatus
}
if(Test-Path -Path "C:\Program Files\Microsoft Office\Office12\OSPP.VBS"){
     $status=cscript "C:\Program Files\Microsoft Office\Office12\OSPP.VBS" /dstatus
}
# Check for  office 2010
if(Test-Path -Path "C:\Program Files (x86)\Microsoft Office\Office14\OSPP.VBS"){
   $status= cscript "C:\Program Files (x86)\Microsoft Office\Office14\OSPP.VBS" /dstatus
}
if(Test-Path -Path "C:\Program Files\Microsoft Office\Office14\OSPP.VBS"){
     $status=cscript "C:\Program Files\Microsoft Office\Office14\OSPP.VBS" /dstatus
}

# Check for  office 2013
if(Test-Path -Path "C:\Program Files (x86)\Microsoft Office\Office15\OSPP.VBS"){
   $status= cscript "C:\Program Files (x86)\Microsoft Office\Office15\OSPP.VBS" /dstatus
}
if(Test-Path -Path "C:\Program Files\Microsoft Office\Office15\OSPP.VBS"){
     $status=cscript "C:\Program Files\Microsoft Office\Office15\OSPP.VBS" /dstatus
}
# Check for  office 2016/office 365 proplus/office 2019
if(Test-Path -Path "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS"){
   $status= cscript "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" /dstatus
}
if(Test-Path -Path "C:\Program Files\Microsoft Office\Office16\OSPP.VBS"){
     $status=cscript "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" /dstatus
}

if (( $status |Select-String -Pattern '---LICENSED---') -ne $null )
{
write-output "True"
}
else
  {
write-output "False"
}

image

image

Click on compliance rules,click New and the value to comply with our script is True.

image

Validate the setting

image

Click next ,next until you see the summary page

image

with this ,we have created the configuration item. we will now create configuration baseline and deploy to collection.

Create new configuration baseline ,name it CB – Office Activation

under configuration data ,choose configuration items and select the CI that we just created

image

you can choose co-managed clients if you have co-management enabled.

we are now ready to deploy this baseline to device collection to get the office activation status.

Before we deploy this to any device collection , it is good practice to create collection with Microsoft office product installed instead deploying to device collection with devices that may or may not have office product installed.

Once you create the collection ,deploy the configuration baseline to the collection.

image

I schedule it onetime instead of recurring schedule .

End results:

Wait for the client to pick the policy and run through the compliance. Or you can run machine policy cycle from the collection (right click tools) to speed up the process.

On activated device (office 365 proplus) , it is compliant

image

on non-activated device (office 365 proplus) ,it is non-compliant.

image

we can also monitor the compliance status using console or SCCM reports.

From the console:

image

I have also uploaded the exported version of Configuration baseline for you . You can download it from here ,extract the zip file and the cab file import into your baseline settings.

4 Responses to "Check Microsoft office activation status using SCCM Compliance Settings"

  1. Looks good but i ran the same query and since I have Project, Visio, and Office 2019 installed. I see 3 lines that show LICENSED.

    Could the Script be tuned to only scan for Office19ProPlus on the off chance that Project or Visio is not Licensed?

    Reply
    1. Hi Brian,
      what does the status shows for the following?
      cscript "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" /dstatus
      does it reveal anything about visio and project?

      Thanks,
      Eswar

      Reply
    1. Hi,
      Product keys do not store in plain text in registry and the only way is to get the status of activation or not.
      For office 365, the activation is not based on key however it is based on license per user which you can get from registry by extending the MOF file.

      Thanks,
      eswar

      Reply

Post Comment