Jump to content
szkoda

Installing .exe silently

Recommended Posts

What is the best way to install a .exe via script in Labtech? I have a .exe installer which has a silent switch and works find if run locally on the machine but I cannot get it to work via Labtech.

 

Tried:

 

- Shell

- Enchanced Shell

- Shell as Admin

 

but they all return ok around 30 seconds and the program is not installed.

 

Any pointers would be great. I never seem to have this issue with .msi but I'm not sure why?

  • Like 1

Share this post


Link to post
Share on other sites

So I done that and am getting the "Install Test Result:" returns 0 message but checking the processes the installer never runs. If I run it again without the /silent switch the .exe appears in task manager then hangs as expected as its probably waiting for input

Share this post


Link to post
Share on other sites

Even in the "SYSTEM with UI" window it hangs without the silent parameters? Try running it just regular, without the silent parameters, in the "SYSTEM with UI" window. It HAS UI access, so if it hangs the problem is not that it is not silent, there is something else. Some common issues are things like: the installer looks for "MyDocuments" or "Desktop" folders. Those don't exist/are not defined for the SYSTEM account. The program attempts to access network resources over a file share: The SYSTEM user often does not have access to shared folders. Another possibility is if the installer is trying to download something from the internet, and the SYSTEM account has a proxy setting configured. (But, probably lots of things would not work in that case, so that isn't very likely) You may need to use Microsoft/Sysinternals "Process Monitor" to trace the registry and file actions for the installer process. You might be able to figure out what it is trying to do that is causing it to hang or malfunction.

Share this post


Link to post
Share on other sites

No in "SYSTEM with UI" without the silent switch it opens the installation program as it would if I double clicked on it.

 

I've just realized when I'm running it silently in either window the exe is creating a log with the following:

 

[05A4:1554][2017-09-01T13:56:33]i001: Burn v3.8.1128.0, Windows v6.1 (Build 7601: Service Pack 1), path: C:\Windows\Temp\LT\InforCRMXbarSetup.exe, cmdline: 'ALLUSERS=1 -silent /switches -burn.unelevated BurnPipe.{EAF19736-8E70-47D8-ACD9-0463B5B15494} {9D4F34E7-4655-4707-95EA-0BB17FECCC51} 7944'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'BundleAction' to value '[WixBundleAction]'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'TARGETDIR' to value '[ProgramFilesFolder]Infor'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'DI_ONLY' to value '0'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'XBAR_ONLY' to value '0'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'SIDEPANEL' to value '1'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'RECORDTOHISTORY' to value '1'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'ADDRESSBOOK' to value '1'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'SYNC' to value '1'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'ACTIVITYPANE' to value '1'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'INSERTVCARD' to value '1'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'INSERTLIBRARY' to value '1'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'DRAGDROP' to value '1'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'GOTOCRM' to value '1'

[05A4:1554][2017-09-01T13:56:33]i000: Setting string variable 'WixBundleLog' to value 'C:\windows\TEMP\Infor_CRM_Xbar_20170901135633.log'

[05A4:1554][2017-09-01T13:56:33]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Windows\Temp\LT\InforCRMXbarSetup.exe'

[05A4:141C][2017-09-01T13:56:33]i000: Setting string variable 'ALLUSERS' to value '1'

[05A4:1554][2017-09-01T13:56:33]i100: Detect begin, 5 packages

[05A4:1554][2017-09-01T13:56:33]i000: Setting string variable 'Net4x64FullRelease' to value '460805'

[05A4:1554][2017-09-01T13:56:33]i000: Setting string variable 'Net4x64FullVersion' to value '4.7.02053'

[05A4:1554][2017-09-01T13:56:33]i000: Setting numeric variable 'OUTLOOK' to value 1

[05A4:1554][2017-09-01T13:56:33]i000: Setting string variable 'Net4FullRelease' to value '460805'

[05A4:1554][2017-09-01T13:56:33]i000: Setting string variable 'Net4FullVersion' to value '4.7.02053'

[05A4:1554][2017-09-01T13:56:33]i000: Setting string variable 'VSTORuntimeVersionInstalled' to value '10.0.50701'

[05A4:1554][2017-09-01T13:56:33]i000: Setting string variable 'VSTORuntimeVersionOfficeInstalled' to value '10.0.60301'

[05A4:1554][2017-09-01T13:56:33]i052: Condition 'Net4FullVersion AND (NOT VersionNT64 OR Net4x64FullVersion)' evaluates to true.

[05A4:1554][2017-09-01T13:56:33]i052: Condition '(Net4FullRelease >= 394271) AND (NOT VersionNT64 OR (Net4x64FullRelease >= 394271))' evaluates to true.

[05A4:1554][2017-09-01T13:56:33]i052: Condition 'VSTORuntimeVersionInstalled' evaluates to true.

[05A4:1554][2017-09-01T13:56:33]i101: Detected package: Net4Full, state: Present, cached: None

[05A4:1554][2017-09-01T13:56:33]i101: Detected package: Net461, state: Present, cached: None

[05A4:1554][2017-09-01T13:56:33]i101: Detected package: VSTORuntime, state: Present, cached: None

[05A4:1554][2017-09-01T13:56:33]i101: Detected package: xbarSetupPerMachine, state: Absent, cached: None

[05A4:1554][2017-09-01T13:56:33]i101: Detected package: xbarSetupPerUser, state: Absent, cached: None

[05A4:1554][2017-09-01T13:56:33]i052: Condition 'NOT (ALLUSERS AND (WixBundleElevated <> 1))' evaluates to true.

[05A4:1554][2017-09-01T13:56:33]i199: Detect complete, result: 0x0

[05A4:1554][2017-09-01T13:56:33]i200: Plan begin, 5 packages, action: Modify

[05A4:1554][2017-09-01T13:56:33]i052: Condition '(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Net4FullVersion OR Net4x64FullVersion))' evaluates to false.

[05A4:1554][2017-09-01T13:56:33]w321: Skipping dependency registration on package with no dependency providers: Net4Full

[05A4:1554][2017-09-01T13:56:33]i052: Condition '(VersionNT >= v6.0 OR VersionNT64 >= v6.0)' evaluates to true.

[05A4:1554][2017-09-01T13:56:33]w321: Skipping dependency registration on package with no dependency providers: Net461

[05A4:1554][2017-09-01T13:56:33]i052: Condition 'NOT VSTORuntimeVersionInstalled' evaluates to false.

[05A4:1554][2017-09-01T13:56:33]w321: Skipping dependency registration on package with no dependency providers: VSTORuntime

[05A4:1554][2017-09-01T13:56:33]i052: Condition 'ALLUSERS' evaluates to true.

[05A4:1554][2017-09-01T13:56:33]w322: Skipping cross-scope dependency registration on package: xbarSetupPerMachine, bundle scope: PerUser, package scope: PerMachine

[05A4:1554][2017-09-01T13:56:33]i052: Condition 'NOT ALLUSERS' evaluates to false.

[05A4:1554][2017-09-01T13:56:33]i201: Planned package: Net4Full, state: Present, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: No, dependency: None

[05A4:1554][2017-09-01T13:56:33]i201: Planned package: Net461, state: Present, default requested: Present, ba requested: Present, execute: None, rollback: None, cache: No, uncache: No, dependency: None

[05A4:1554][2017-09-01T13:56:33]i201: Planned package: VSTORuntime, state: Present, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: No, dependency: None

[05A4:1554][2017-09-01T13:56:33]i201: Planned package: xbarSetupPerMachine, state: Absent, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: No, dependency: None

[05A4:1554][2017-09-01T13:56:33]i201: Planned package: xbarSetupPerUser, state: Absent, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: No, dependency: None

[05A4:1554][2017-09-01T13:56:33]i299: Plan complete, result: 0x0

[05A4:1554][2017-09-01T13:56:33]i300: Apply begin

[05A4:1554][2017-09-01T13:56:33]i399: Apply complete, result: 0x0, restart: None, ba requested restart: No

[05A4:1554][2017-09-01T13:56:33]i500: Shutting down, exit code: 0x0

[05A4:1554][2017-09-01T13:56:33]i410: Variable: ACTIVITYPANE = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: ADDRESSBOOK = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: ALLUSERS = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: BundleAction = 5

[05A4:1554][2017-09-01T13:56:33]i410: Variable: DI_ONLY = 0

[05A4:1554][2017-09-01T13:56:33]i410: Variable: DRAGDROP = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: GOTOCRM = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: INSERTLIBRARY = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: INSERTVCARD = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: Net4FullRelease = 460805

[05A4:1554][2017-09-01T13:56:33]i410: Variable: Net4FullVersion = 4.7.02053

[05A4:1554][2017-09-01T13:56:33]i410: Variable: Net4x64FullRelease = 460805

[05A4:1554][2017-09-01T13:56:33]i410: Variable: Net4x64FullVersion = 4.7.02053

[05A4:1554][2017-09-01T13:56:33]i410: Variable: OUTLOOK = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: RECORDTOHISTORY = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: SIDEPANEL = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: SYNC = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: TARGETDIR = C:\Program Files (x86)\Infor

[05A4:1554][2017-09-01T13:56:33]i410: Variable: VersionNT = 6.1.0.0

[05A4:1554][2017-09-01T13:56:33]i410: Variable: VersionNT64 = 6.1.0.0

[05A4:1554][2017-09-01T13:56:33]i410: Variable: VSTORuntimeVersionInstalled = 10.0.50701

[05A4:1554][2017-09-01T13:56:33]i410: Variable: VSTORuntimeVersionOfficeInstalled = 10.0.60301

[05A4:1554][2017-09-01T13:56:33]i410: Variable: WixBundleAction = 5

[05A4:1554][2017-09-01T13:56:33]i410: Variable: WixBundleElevated = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: WixBundleInstalled = 1

[05A4:1554][2017-09-01T13:56:33]i410: Variable: WixBundleLog = C:\windows\TEMP\Infor_CRM_Xbar_20170901135633.log

[05A4:1554][2017-09-01T13:56:33]i410: Variable: WixBundleManufacturer = Infor

[05A4:1554][2017-09-01T13:56:33]i410: Variable: WixBundleName = Infor CRM Xbar

[05A4:1554][2017-09-01T13:56:33]i410: Variable: WixBundleOriginalSource = C:\Windows\Temp\LT\InforCRMXbarSetup.exe

[05A4:1554][2017-09-01T13:56:33]i410: Variable: WixBundleProviderKey = {cb8a5720-ba70-45c0-b427-d3909022d854}

[05A4:1554][2017-09-01T13:56:33]i410: Variable: WixBundleTag =

[05A4:1554][2017-09-01T13:56:33]i410: Variable: WixBundleVersion = 1.37.1961.0

[05A4:1554][2017-09-01T13:56:33]i410: Variable: XBAR_ONLY = 0

[05A4:1554][2017-09-01T13:56:33]i007: Exit code: 0x0, restarting: No

 

I can't really see anything in the above saying what the error is?

Share this post


Link to post
Share on other sites

Strangely if I run the install with the silent switch from a standard command prompt directly on the machine it doesn't create the log file at all!

Share this post


Link to post
Share on other sites

I've just tried changing the account the labtech services uses to my local admin account and now the script works using SHELL and SHELL AS ADMIN and SHELL AS USER.

 

I don't understand why SHELL AS ADMIN and SHELL AS USER doesn't work when the services are running as system? Surely it should be running the installer as either the admin account I've specified or my user account?

Share this post


Link to post
Share on other sites

I have spoken to the developer of the software and the installer creates a reg key under HKCU so needs to run as the user so using CONSOLE SHELL should work with IF USER LOGGED ON but for some reason it's not!

Share this post


Link to post
Share on other sites

CONSOLE SHELL is not privileged. It will run as the user, but without elevation. Run As Admin has no specific effect when the service is already running as the administrator. If SHELL works when running the service as Administrator, then SHELL AS Admin should work as well, and it rules out the installer requiring active console access. If Run As Admin is failing when LabTech is running as SYSTEM, then UAC is blocking you (assuming that the username/password/group membership/rights have already been verified for the account). Going back to the PSEXEC tests, try

psexec -h -u domain\username cmd.exe

This will launch a shell as Administrator, but without access to a shell/console for UI. This is what Shell As Admin should be doing, and if you can make it work from that environment then Shell As Admin should be workable as well.

Share this post


Link to post
Share on other sites

Problem is that it create's key's under HKCU so it needs to be run as the user (It's an Outlook addin). Interestingly I have updated the Labtech server this morning to the latest patch and it now appears to be working! Haven't actually verified it on the users machine yet but I can see the entry under the software list on the machine in Labtech which is further than it was getting before.

 

Thanks again for the help Darren, the stuff you've posted will no doubt help me for the next piece of random software clients will have me deploying!

Share this post


Link to post
Share on other sites

The entry will be reported in Add-Remove programs when it is installed by the logged on user. If you manage to get it installed as System it should always show, but as a user it will not be reported if the user logs out and software is inventoried.

 

I recently went through deploying an Outlook Add-In. Here are some tips:

For silent installs to work, it is best to manually install any pre-requisites. This means noting what the MSI logs report as pre-requisite checks, or noting what installers are automatically triggered during test installs. I figured out the silent parameters for each piece of the setup through trial and error, research, testing. I used Process Monitor to find out what commands the installer was running in the background, I would wait to acknowledge any prompts and would check the user and system %temp% folders to see what binaries were being extracted from the setup and then launched to find each of the dependencies.

 

In the end, for the Add-in I was working with the overall process looks like this.

  • Crystal Reports Runtime was needed. Checked Installed Software, downloaded and installed if needed.
  • .Net 4.61 or higher was needed. Triggered .Net 4.61 Installer script, which installs if needed. Then checked registry key to confirm .Net was above required version before continuing.
  • Installed Vendor Application - This was a companion program to the Add In. Checked Installed Software, downloaded and installed if needed. For this particular application, I ran a batch file that installed, passing silent parameters and setting the install folder to "%PUBLIC%\Vendor App", then running icacls to grant everyone modify permissions to this folder. (So users don't need to be admins to operate the program, and the same binary is used for everyone instead of installing to a per-user folder).
  • The Add-in was built with Microsoft Visual C++ 2010 and required the Visual C++ 2010 Redistributable and Microsoft Visual Studio 2010 Tools for Office Runtime (x86 or x64). Checked Installed programs, downloaded and installed if the components were not already available.
  • The Add-in publisher needed to be trusted. You can import and push this through group policy, but what I did was made a batch file with the certificate embedded inside, that extracted to a file and then ran ' certutil.exe -addstore TRUSTEDPUBLISHER "%CERTFILE%" '.
  • Finally, the add-in. The vendor installer had no silent option, but I discovered that it was just a front end for "C:\Program Files (x86)\Common Files\Microsoft Shared\VSTO\10.0\VSTOInstaller.exe". In my research, it seems like this is normal for Outlook Add-ins. The command:
    "C:\Program Files (x86)\Common Files\Microsoft Shared\VSTO\10.0\VSTOInstaller.exe" /install "http://vendorURLnet/VendorAddin.vsto" /silent

    was actually all that the installer was running, and all that needed to be ran by the user.

  • To make each user run this as themselves is tricky. A Login script is a simple way to do it with group policy, but I leveraged the "Active Setup" registry keys. I generated a GUID for myself, and under HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{MYGUID} I created a registry default value, a value named "Version", and a value named "StubPath". StubPath simply contains the command line that you want to be run by the user. Each time a user (existing or new) logs in, the registry values are checked against HKCU, including the Version value. If the HKLM Version>HKCU Version, or the HKCU Active Setup key for that GUID doesn't exist, it runs the "StubPath" command as the user and updates the HKCU registry. It will not run the command again for that user, unless you cause the Version number to increase. I made my Installer batch file retrieve the current version value each time the LabTech "Installer" script was run against the machine, so that it would always be larger and trigger a re-installation for all users on their next login. The command in StubPath was the one piece that if a user was logged in, I could execute as them through LabTech.
  • I created an uninstaller script as well. It just used the same Active Setup GUID (so that there couldn't be install and uninstall commands active at the same time), but changed the StubPath to contain the add-in removal command:
    "C:\Program Files (x86)\Common Files\Microsoft Shared\VSTO\10.0\VSTOInstaller.exe" /Uninstall "http://vendorURLnet/VendorAddin.vsto" /silent

 

Here is a helpful page on ActiveSetup - http://sccmpackager.blogspot.com/2013/07/active-setup-what-is-active-setup.html. Hopefully this helps you put together a full fledged silent installer for your add-in.

Share this post


Link to post
Share on other sites
[05A4:1554][2017-09-01T13:56:33]i001: Burn v3.8.1128.0, Windows v6.1 (Build 7601: Service Pack 1), path: C:\Windows\Temp\LT\InforCRMXbarSetup.exe, cmdline: 'ALLUSERS=1 -silent /switches -burn.unelevated BurnPipe.{EAF19736-8E70-47D8-ACD9-0463B5B15494} {9D4F34E7-4655-4707-95EA-0BB17FECCC51} 7944'

[05A4:1554][2017-09-01T13:56:33]i000: Initializing string variable 'TARGETDIR' to value '[ProgramFilesFolder]Infor'

[05A4:141C][2017-09-01T13:56:33]i000: Setting string variable 'ALLUSERS' to value '1'

 

[05A4:1554][2017-09-01T13:56:33]i052: Condition 'Net4FullVersion AND (NOT VersionNT64 OR Net4x64FullVersion)' evaluates to true.

[05A4:1554][2017-09-01T13:56:33]i052: Condition '(Net4FullRelease >= 394271) AND (NOT VersionNT64 OR (Net4x64FullRelease >= 394271))' evaluates to true.

[05A4:1554][2017-09-01T13:56:33]i052: Condition 'VSTORuntimeVersionInstalled' evaluates to true.

[05A4:1554][2017-09-01T13:56:33]i101: Detected package: VSTORuntime, state: Present, cached: None

[05A4:1554][2017-09-01T13:56:33]i101: Detected package: xbarSetupPerMachine, state: Absent, cached: None

[05A4:1554][2017-09-01T13:56:33]i101: Detected package: xbarSetupPerUser, state: Absent, cached: None

[05A4:1554][2017-09-01T13:56:33]i052: Condition 'ALLUSERS' evaluates to true.

[05A4:1554][2017-09-01T13:56:33]i201: Planned package: xbarSetupPerMachine, state: Absent, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: No, dependency: None

 

I selected a few lines from the MSI log you posted, highlighting how it shows some of what components are needed. .Net version >=394271 x86, and x86 for 64 bit systems is needed. The VSTO (Visual Studio Tools) Runtime is needed. And I notice that you specified ALLUSERS=1, which is good as it should install to a central path instead of per-user.

Share this post


Link to post
Share on other sites

Wow thanks Darren for the detailed reply (why can't labtech support be this helpful!).

 

I've managed to get the addin to install on most windows 7 machines but it hasn't deployed to any windows 10 machines so there are probably additional considerations I need to make there. To throw a spanner in the works it's not a fresh install of the software, it's actually upgrading an older version so that also complicates things.

 

When you deployed your Outlook addin did you specify anywhere in the script to close outlook if it's running or did you run it with Outlook still open?

Share this post


Link to post
Share on other sites

Honestly, I don't recall addressing that. If one of the pieces (VSTO comes to mind) had an option to force the app closed, I probably enabled that. Since the per-user piece really isn't installed until their next login, I don't think Outlook running was an obstacle. I created the script and handed it off to another co-worker. I believe it was rolled to about 150 agents in and out of the office (which is why Group Policy wasn't desirable as a deployment method) and I was told that it went beautifully. The only follow up tweak I did was to also create registry values that force the add-on to be enabled (in case it was flagged as a "slow starter") and also prevented users from even manually disabling it, after some reports of people seeing it self disable.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...