Jump to content
Sign in to follow this  
Haider Shah

Copy a MSI and create a script to remove a program using that MSI

Recommended Posts

Hi guys,

 

I need to copy a .msi from a server share to a local PC using a script. I then need to create another script to remove a program using the copied .msi.

Does anyone know how to create a script for this? I tried and cannot get it to work.

Share this post


Link to post
Share on other sites

What did you do so far? Where is it failing? If you going to copy over the network you will have to use Gavsto guide to run as admin.

Share this post


Link to post
Share on other sites

Suggestion:  Don't try to copy the file from a server share, stage the .msi file on your LabTech server at %lltshare%\transfer and download it from there.  That will make the File Download work flawlessly and you won't get hung up with credentials.

Once it is on the target computer, use 'Shell' to install it.  %windir%\system32\msiexec.exe FTW.  https://www.advancedinstaller.com/user-guide/msiexec.html  This will install the application as the Local System Account.

I like to use the /L switch and 'File Upload' the logs.  That way, if there's an issue, you can easily see the installation logs.

Share this post


Link to post
Share on other sites

Hi everyone,

 

Apologies for the delayed response.

I have created the following script for this:

 

msiexec /x "\\SERVER\Software\InternalApps\SOFTWARE.msi" /quiet

 

@LabTechRob - can you please show or teach me how to use the LT server? I am pretty new to this and would love to know how I could make things easier.

Share this post


Link to post
Share on other sites

FWIW if you want the existing method to work you can change the share and file permissions (separately) on the \\server\Software to have at least read access for "Domain Computers" and it will work as is. It may be simpler to do as previously suggested and download the file directly from the LTShare but if that is not an option because of size or bandwidth limitations you can set the share and file permissions to allow "SYSTEM" to access the share.

It is worth noting that locally on the PC running the script it is by default running that script as "SYSTEM". To the remote server that is authenticating that user it is seen as TheNameOfThePCRunningTheScript$. If you did not want to allow all "Domain Comptuters" read access technically you could add just the one PC to the Share and File permissions. Practically this does not make much sense, but it does help with the overall understanding hopefully.

To test you will want to try to access the UNC path from the labtech command prompt tab on a PC at that site.

dir \\server\Software

dir \\server\Software\InternalApps

dir \\server\Software\InternalApps\SOFTWARE.msi

If it does not list the directory or file then your share and or file permissions are not yet allowing "Domain Computers" read access.

Share this post


Link to post
Share on other sites
Quote

LabTechRob - can you please show or teach me how to use the LT server? I am pretty new to this and would love to know how I could make things easier.

I can't show you how to use the server (big topic, there!) but I can better explain how to stage a file for installation.

In this example, I'm going to install WinRar.  Step 1: Get the software.  Goto their website and download the build file (winrar-x64-56b5.exe).  Because my environment also has 32 bit computers, I also get the 32 bit installer (wrar56b5.exe.)

Step 2: Stage the software.  On the LabTech server, I open c:\Transfer\Software.  I create a WinRAR folder and copy the two files (above) into that folder.  My build files are now ready for distribution to my users.

Step 3: Create the installation script.  Here is an installation template that holds the minimum actions you'll need to get the job done - file download and the install command:
image.thumb.png.2aebc658049941780bab931a23e30443.png

The only thing left here is to alter the initial IF statement so you're not installing RAR on machines that already have WinRAR.  For this, I suggest using the IF 'Registry Check' comparison.

Edited by LabTechRob

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.

Sign in to follow this  

×
×
  • Create New...