Most likely I will have a dooogh moment the second someone can answer this for me, but here it goes anyway.......
I have a corrupted msi installation, so I want to create a packaged file which allows me to do the following
uninstall the existing prg and re-install again
MsiExec.exe /X{Drw8F69F-54A2-4280-AwrD-3E985E3wrFD9} /q
MsiExec.exe /i "C:\Temp\Filename.msi" /qn
gpupdate
I run it in cmd as only the CMD (run as admin) and it works fine
If I run it fom the packaged file it barks
setup as follows
from command line 32 bit
Powershell v2
Run as specified user : domain user with admin rights to the PC
So when I start the executable it opens a cmd prompt and the presents me with the msi help box
Windows ® Installer. V 5.0.7601.17514
msiexec /Option <Required Parameter> [Optional Parameter]
That is all it does, could someone please let me know what I am missing < i know it is realy easy
Thank you in advance
running msi from within packaged file with elevated rights
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- Carpe_diem
- Posts: 22
- Last visit: Thu Feb 10, 2022 1:50 pm
- Carpe_diem
- Posts: 22
- Last visit: Thu Feb 10, 2022 1:50 pm
Re: running msi from within packaged file with elevated righ
its not realy a script more some uninstall msi and install msi
including (not realy powershell)
del "C:\Users\Public\Desktop\FIlename Desktop.lnk"
MsiExec.exe /uninstall {D38dad9F-54ad-aaad-A3AD-3E985fda3B3FD9} /passive
MsiExec.exe /i "C:\Temp\filename.msi" /passive
ren "C:\Users\Public\Desktop\filename.lnk" "newfilename.lnk"
gpupdate
including (not realy powershell)
del "C:\Users\Public\Desktop\FIlename Desktop.lnk"
MsiExec.exe /uninstall {D38dad9F-54ad-aaad-A3AD-3E985fda3B3FD9} /passive
MsiExec.exe /i "C:\Temp\filename.msi" /passive
ren "C:\Users\Public\Desktop\filename.lnk" "newfilename.lnk"
gpupdate
- Carpe_diem
- Posts: 22
- Last visit: Thu Feb 10, 2022 1:50 pm
Re: running msi from within packaged file with elevated righ
I think i have to go after the LocalPackage instead of the string
Re: running msi from within packaged file with elevated righ
It is probable this line.
MsiExec.exe /uninstall {D38dad9F-54ad-aaad-A3AD-3E985fda3B3FD9} /passive
You will need to escape the {}
MsiExec.exe /uninstall {D38dad9F-54ad-aaad-A3AD-3E985fda3B3FD9} /passive
You will need to escape the {}
PowerShell Code
Double-click the code block to select all.MsiExec.exe /uninstall `{D38dad9F-54ad-aaad-A3AD-3E985fda3B3FD9`} /passiveTry that. It may work.
Re: running msi from within packaged file with elevated righ
This generally is easier:
PowerShell Code
Double-click the code block to select all.$arglist='/uninstall {D38dad9F-54ad-aaad-A3AD-3E985fda3B3FD9} /passive' Start-Process -FilePath msiexec.exe -ArgumentList $arglist
- Carpe_diem
- Posts: 22
- Last visit: Thu Feb 10, 2022 1:50 pm
Re: running msi from within packaged file with elevated righ
found the uninstall string
$file = Get-WmiObject -Class win32_product | where { $_.Name -like "*filename*"}
$file.localPackage
msiexec /x $file.localPackage /passive
now the install
$file = Get-WmiObject -Class win32_product | where { $_.Name -like "*filename*"}
$file.localPackage
msiexec /x $file.localPackage /passive
now the install
- Carpe_diem
- Posts: 22
- Last visit: Thu Feb 10, 2022 1:50 pm
- Carpe_diem
- Posts: 22
- Last visit: Thu Feb 10, 2022 1:50 pm
Re: running msi from within packaged file with elevated righ
it does uninstall perfect , but it wont install the new msi
Re: running msi from within packaged file with elevated righ
That is because the install starts before the uninstall is finished.mstrasser wrote:it does uninstall perfect , but it wont install the new msi
You can try the -wait switch
PowerShell Code
Double-click the code block to select all.# $arglist='/uninstall {D38dad9F-54ad-aaad-A3AD-3E985fda3B3FD9} /passive' Start-Process -FilePath msiexec.exe -ArgumentList $arglist -Wait #