Page 1 of 1

Executing VBS scripts via Office 2016 package

Published: July 26, 2018 - 12:32 PM
by Patrice_minagri
Hello everyone,

I'm writing to you because I'm a bit lost. I'm currently creating a package for installing Office 2016, in which I want to handle the removal of previous versions of Office, such as 2003, 2007, and 2010, beforehand.

To perform this removal, I downloaded the Microsoft Fixit tools for each Office version. When each Fixit tool is run, a temporary VBScript file is created which is sufficient to remove the various versions of Office 2003 and others.

These files are called Offscrub03.vbs (for 2003), Offscrub07.vbs (for 2007), etc.

To completely uninstall the products, simply enter the following command:

Code: Select all

cscript Offscrub03.vbs /ALL /Q /NoCancel /BYPASS 1


This command works perfectly when entered directly at the DOS prompt.

However, in the WAPT package code:

Code: Select all

run('script "Offscrub03.vbs" /ALL /Q /NoCancel /BYPASS 1')
It's not working. I'm getting the following error:

Code: Select all

<RunOuput returncode :0>
"Microsoft (R) Windows Script Host Version 5.8\r\nCopyright (C) Microsoft Corporation 1996-2001. Tous droits r\x82serv\x82s.\r\n\r\nMicrosoft Customer Support Services - Office 2003 Removal Utility\r\n\r\nVersion: 1.39\r\n64 bit OS: Vrai\r\nStart removal: 26/07/2018 10:53:49\r\n\r\nInsufficient registry access permissions - exiting\r\nc:\\Offscrub03.vbs(119, 5) Erreur d'ex\x82cution Microsoft VBScript: Variable non d\x82finie: 'TmpKeyCleanUp'\r\n\r\n"
We are therefore talking about rights that would be insufficient to access the register.

My question is this:
Why do we have two different results where in one case rights don't seem to be a problem at all and in the other they are? Is there another way to do this?

Thank you very much, my Waptian friends!

Re: Running VBScripts via Office 2016 Package

Published: July 30, 2018 - 9:56 PM
by vcardon
Hello Patrice,

Your post deserves a reply because we know each other well and we're very proud that WAPT is of interest to your large and prestigious organization (whose identity I cannot reveal out of respect for confidentiality).

I'm not the WAPT super expert, but I would suggest creating a new Office 2016 package that conflicts with your previous Office packages. So, search for "conflict" in the WAPT documentation for more information on this function.

Your previous Office packages, if they exist, will have had an uninstallation key. Therefore, running the WAPT package for your Office 2016 would uninstall the previous versions because they would conflict with the version of Office you want to install. This way, you wouldn't need to rely on a specific Microsoft VBS—magic!

This method has the added benefit of being more robust and easier to manage over time.

When everyone returns from vacation, we'll be discussing with Mr. S. and Mr. F. from Toulouse, and Mr. A. and Mr. D. from Paris, to upgrade you to the Enterprise version, which is better suited to your needs.

In the meantime, have a great summer.

Sincerely,

Vincent

Re: Running VBScripts via Office 2016 Package

Published: September 6, 2018 - 11:26 AM
by htouvet
It seems that the problem is "known":
https://social.technet.microsoft.com/Fo...roprevious
I had the same issue when running the script with SCCM 2012 in system context on Win7. For some reason the function CheckRegPermissions returns false. When I ran the script manually with admin rights it worked. It even worked when I tried with psexec -s \\machine cmd which launches a command prompt in system context.

I decided to delete the code in CheckRegPermissions. The script works fine now and does what it should.

Function CheckRegPermissions
CheckRegPermissions = True
End Function 'CheckRegPermissions