Executing VBS scripts via Office 2016 package

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Patrice_minagri
Messages: 57
Registration: Oct 21, 2016 - 4:56 p.m.

July 26, 2018 - 12:32

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!
WAPT 1.7.4
User avatar
vcardon
WAPT Expert
Messages: 278
Registration: Oct 06, 2017 - 10:55 p.m.
Location: Nantes, France

July 30, 2018 - 9:56 PM

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
Vincent CARDON
Tranquil IT
User avatar
htouvet
WAPT Expert
Messages: 436
Registration: March 16, 2015 - 10:48
Contact :

September 6, 2018 - 11:26

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
Tranquil IT
Locked