Jump to content

Recommended Posts

Posted

Hello,

 

Hoping someone can help with the below script?

Were moving to SCCM over Summer and I'm getting our Applications ready now.

Creating an application for Office 2016 was easy enough except for the activation. I've had to create a PowerShell script to run afterwards that looks like this:

if ((gwmi win32_operatingsystem | select osarchitecture).osarchitecture -eq "64-bit") {Write-Host "64 Bit OS Detected - Running 64 Bit Activation"& "C:\Windows\system32\cscript.exe" "C:\Program Files (x86)\microsoft office\office16\ospp.vbs" /inpkey:XXXXX-YYYYY-ZZZZZ-AAAAA-BBBBB& "C:\Windows\system32\cscript.exe" "C:\Program Files (x86)\microsoft office\office16\ospp.vbs" /act}if ((gwmi win32_operatingsystem | select osarchitecture).osarchitecture -eq "32-bit") {Write-Host "32 Bit OS Detected - Running 32 Bit Activation"& "C:\Windows\system32\cscript.exe" "C:\Program Files\microsoft office\office16\ospp.vbs" /inpkey:XXXXX-YYYYY-ZZZZZ-AAAAA-BBBBB& "C:\Windows\system32\cscript.exe" "C:\Program Files\microsoft office\office16\ospp.vbs" /act}exit

 

It looks to activate fine but I am trying to sort the installation success detection now. I have been trying to do this based on the output of the ospp.vbs /dstatus command.

There is a line that shows LICENSE STATUS: ---LICENSED---

I am using the following code to try and extract this line but it always returns a failure, can someone tweak the line below so that I can use this as a success mechanism?

if (((& C:\Windows\System32\cscript.exe "C:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs" /dstatus) | Select-String -Pattern "LICENSE STATUS:") -contains "-LICENSED-") {Write-Host "Rule Matches"} ELSE {Write-Host "Not Detected"}

 

 

Ignore the Write-Host command, I am going to change this to Write-Event and check the event viewer for the success status.

 

Hopefully that makes sense. I am new to SCCM so if there is an easier way to do this any help would be great.

 

Thanks.

  • 3 weeks later...
Posted

Hopefully that makes sense. I am new to SCCM so if there is an easier way to do this any help would be great.

 

Thanks.

 

Our Office 2016 deployment just looks for {90160000-0011-0000-1000-0000000FF1CE}

 

Any reason you have this working with anything more complicated than that?

Posted
There is a WMI class which tells you the status of MS Software activations, it's SoftwareLicensingProduct. You could use that to interrogate the system rather than ospp.vbs
Posted
Our Office 2016 deployment just looks for {90160000-0011-0000-1000-0000000FF1CE}

 

Any reason you have this working with anything more complicated than that?

Yup, that's what we have to detect the 'install' of Office 2016 yeah - but that says nothing for whether it's successfully activated or not.

 

Therefore we have a script that definitively runs the vbs activation as per this thread. Then this thread was about detecting the output of that script using a powershell command.

 

Pretty sure we won't have this problem if I start using a KMS licensing server as it should just detect it on the network, but for MAK this is unfortunately what were having to do.

Posted
There is a WMI class which tells you the status of MS Software activations, it's SoftwareLicensingProduct. You could use that to interrogate the system rather than ospp.vbs
That's interesting to know, I may take a look into that. Thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...