ITManLT Posted June 5, 2019 Posted June 5, 2019 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.
fordea Posted June 6, 2019 Posted June 6, 2019 You should get what you're after by changing the -contains operator to -match in your if statement 1
ITManLT Posted June 9, 2019 Author Posted June 9, 2019 Thanks for your reply Fordea, to confirm, that worked a treat! I tried so many of the operators but didn't try match!
gwendes Posted June 25, 2019 Posted June 25, 2019 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?
Norphy Posted June 25, 2019 Posted June 25, 2019 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
ITManLT Posted June 25, 2019 Author Posted June 25, 2019 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.
ITManLT Posted June 25, 2019 Author Posted June 25, 2019 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.vbsThat's interesting to know, I may take a look into that. Thanks
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now