I'm trying to install Oracle Clinet 12.2.0 32bit with silent mode. Oracle setup.exe called by my powershell script failed to install with exit code -2. please anyone tell me setup.exe exit code "-2" meaning and how to fix it.
Set-Location C:\Scripts\OracleClient\client32
Write-Host "Starting Oracle Client install"
$process = (Start-Process .\setup.exe -ArgumentList "-silent -force -waitforcompletion -nowait -ignoreSysPrereqs -ignorePrereq -responseFile C:\Scripts\oracleclient.rsp" -PassThru)
$process.WaitForExit()
Write-Host "Oracle Client install Process exit code : " $process.ExitCode
thanks
Seems like -2 stands for that the client is already installed.
It checks it based on the xml files in C:\Program Files (x86)\Oracle\Inventory\ContentsXML
In the Inventory folder there is also a logs folder where you can find more details.
I tested out and found a problem also resulted in -2 when installing version 19c.
Existing environment variable ORACLE_HOME with old path caused the error.
setting it to $null solved my problem.
Related
I need to prepare a powershell script, that I can use after installing Windows. The script will install basic programs with Winget.
The problem is, that after an installation of Windows, the App Installer isn't updated, so the Winget can't work.
In order to solve the problem, I wrote a PowerShell code that downloads an already updated file for the App installer from my Google Drive, and installs it.
The problem is, that because the App installer is already installed at my PC, and it only needs an update, I receive an error.
(If I install the file manually it works)
I decided to delete the folders in the path "C:\Program Files\WindowsApps" of the app installer, and then I saw that it's not possible to delete the files because the access is denied.
I'm looking for a way to take ownership of the files with a powershell command.
I tried several commands and still when I tried to delete it, it returnes access denied.
For example:
takeown /f "C:\Program Files\WindowsApps" /a /r
returned an error.
How can I update the existing the App Installer using the msixbundle file with a PowerShell command?
If it's not possible, how can I delete these files without an error?
Thanks a lot!!!
This is my code:
takeown /f “C:\Program Files\WindowsApps” /r
takeown /f “C:\Program Files\WindowsApps” /a /r
takeown /f “C:\Program Files\WindowsApps” /r /d y
icacls “C:\Program Files\WindowsApps” /grant administrators:F /t
Get-Childitem -Path "C:\Program Files\WindowsApps" -Recurse | Where-Object {$_.Name -ilike "*DesktopAppInstaller*"} | Remove-Item -recurse -force
New-Item "C:\new1" -itemType Directory
$URL=The link to Google Drive is here.
$PATH="C:\new1\AppInstaller1.msixbundle"
Invoke-WebRequest -URI $URL -OutFile $Path
Add-AppPackage -path "C:\new1\AppInstaller1.msixbundle"
Remove-Item "C:\new1" -Recurse
the installing error message:
Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3,
Package failed updates, dependency or conflict validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.18.2691.0_x64__8wekyb3d8bbwe
because this package depends on a framework that could not be found.
Provide the framework "Microsoft.UI.Xaml.2.7" published by
"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US",
with neutral or x64 processor architecture and minimum version 7.2109.13004.0,
along with this package to install.
The frameworks with name "Microsoft.UI.Xaml.2.7" currently installed are: {}
NOTE: For additional information, look for [ActivityId] 10f677b2-f6bc-0000-971e-f710bcf6d801 in the Event Log or use
the command line Get-AppPackageLog -ActivityID 10f677b2-f6bc-0000-971e-f710bcf6d801
At line:1 char:1
Add-AppxPackage -path "C:\n1\DesktopAppInstaller.Msixbundle"
CategoryInfo : WriteError: (C:\n1\DesktopAppInstaller.Msixbundle:String) [Add-AppxPackage], IOException
FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand
I found the solution!
On the download page of the AppInstaller at https://store.rg-adguard.net
(package: https://www.microsoft.com/store/productId/9NBLGGH4NNS1)
There are the missing packages for installation.
I downloaded and installed them and then everything worked.
(no need to delete the old installation).
Thanks to #mklement0 for helping me reach a solution!
I've written a script that downloads the MS ODBC driver, installs it, then checks the new driver .dll exists. However, I'm stuck on the "installs it" part.
The best version of the install command I have right now is: Start-Process -Filepath "msiexec.exe" -ArgumentList "/i msodbcsql.msi", "/qb", "IACCEPTMSODBCSQLLICENSETERMS=YES"
When I run this on its own (to troubleshoot it), however, the installer launches and immediately displays the error:
The required IACCEPTMSODBCSQLLICENSETERMS=YES command-line parameter is missing.
If I run Start-Process -Filepath msiexec -ArgumentList /i, "msodbcsql.msi" the regular GUI installer starts up which presumably means the "/qb", "IACCEPTMSODBCSQLLICENSETERMS=YES" part of the command is the problem.
I'm having no luck with this in spite of adapting every example I can find on the web. I'd be grateful for help!
The problem: I wasn't running PowerShell in Administrator mode 😖
in order to distribute Zabbix in our company, I would like to create a function for the Zabbix 5.2 client in my installation script.
This also means that zabbix_agentd.exe is registered as a service with the associated parameters.
I am apparently too stupid to do this with the start-process.
The following line serves as an example .. I've tried a few things but couldn't find a suitable quotation, etc.
start-process -FilePath cmd.exe -ArgumentList "/c c:\program files (x86)\zabbix\zabbix_agend.exe --config C:\Program Files (x86)\Zabbix\zabbix_agentd.win.conf --install"
I also hope that I can transfer the path to zabbix_agentd.exe as a variable
Ih hope someone has a tip.
Thanks in advance
For Windows I use the MSI for installations and check the registry if the correct version is already installed else upgrade.
Replace and for your own.
$zabbixversion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Zabbix SIA\Zabbix Agent (64-bit)").ProductVersion
if ($zabbixversion -eq "5.0.20.2400") {
write-host "Zabbix already installed"
exit
}
else
{
write-host "Uninstall Zabbix Agent"
msiexec /uninstall \\<share>\zabbix_agent-5.0.20-windows-amd64-openssl.msi server=<SERVERIP> sport=10050 lport=10050 SERVERACTIVE=<SERVERIP> rmtcmd=0
write-host "Installing Zabbix Agent"
msiexec /I \\<share>\\zabbix_agent-5.0.20-windows-amd64-openssl.msi server=<SERVERIP> sport=10050 lport=10050 SERVERACTIVE=<SERVERIP> rmtcmd=0
}
You should use the MSI package instead.
You can specify as parameters the host name/ip address of the server, the remote command support, the psk support etc...
You can then launch it with cmd/powershell or even better via GPO
See the documentation page for some of examples
We package our software to MSI files (using Wix).
We use VSTS for Builds and Releases.
Is there a standard way to deploy MSI file as part of the Release?
Yes, I can run msiexec /i ... as PowerShell or batch script. But we would need a few other things, for example checking exit code, uploading install log file back to VSTS Release or analysing error message, etc.
This all sounds like quite common thing people would like to do, but there is no such standard VSTS step \ extension for this.
I ended up packaging VSTS extension for this:
https://marketplace.visualstudio.com/items?itemName=ivanboyko.vsts-deploy-MSI
Source code is open-sourced:
https://github.com/IvanBoyko/vsts-install-MSI.git
You can specify log file in msiexec command to install MSI file, then check the detail log content (whether contains errors) by using PowerShell, if there are errors in the log, you can log error or warning by using ##vso[task.logissue].
Regarding upload log file, you can use ##vso[build.uploadlog]local file path to upload installer log file.
More information about logging commands, you can refer to this article: Logging Commands.
Simple code to install MSI and wait for the installer to finish:
$filePath='[msi file path]'
$DataStamp = get-date -Format yyyyMMddTHHmmss
$logFile = 'c:\{0}-{1}.log' -f 'nodejsInstall',$DataStamp
$MSIArguments = #(
"/i"
('"{0}"' -f $filePath)
"/qn"
"/norestart"
"/L*v"
$logFile
)
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow
I'm trying to install a msi file on a remote server using powershell.
Server 1 is my build server and server 2 is my application server.
When the build server finishes a buil, I want to trigger a powershell script to install the latest version to my application server.
I'm using the following command to create a session and execute the installation:
# Create session to Application Server
$Session = New-PSSession -Name <ApplicationServer> -ComputerName <ApplicationServer> -Auth CredSSP -cred OURDOMAIN\MyUser
# Prepare expression and create script block
$Script = "Invoke-Expression 'msiexec /i <InstallerFile> /qn /L*v C:\Temp\install_fail.log'"
$ScriptBlock = [Scriptblock]::Create($Script)
# Execute in the session
Invoke-Command -ScriptBlock $ScriptBlock -Session $Session
# Clean up the session
Remove-PSSession $Session
The log has the following error (see attachment install_fail.log for full log)
MSI (s) (C4:1C) [17:08:05:333]: Note: 1: 1708
MSI (s) (C4:1C) [17:08:05:333]: Product: WindowsService1 -- Installation failed.
MSI (s) (C4:1C) [17:08:05:335]: Windows Installer installed the product. Product Name: WindowsService1. Product Version: 8.0.0.0. Product Language: 1033. Manufacturer: MyCompany. Installation success or error status: 1603.
When I start a session on the powershell command promt and execute the installation the installation succeeds (see attachment install_success.log for full log):
ENTER-PSSession -ComputerName
Invoke-Expression 'msiexec /i /qn /L*v C:\Temp\install_success.log'
exit
When I print whoami in both cases it returns OURDOMAIN\MyUser.
Microsoft lists the following regarding the 1603: (http://support.microsoft.com/kb/834484)
The folder that you are trying to install the Windows Installer package to is encrypted.
The folder is not encrypted
The drive that contains the folder that you are trying to install the Windows Installer package to is accessed as a substitute drive.
The drive is a partition on the harddisk of the server
The SYSTEM account does not have Full Control permissions on the folder that you are trying to install the Windows Installer package to. You notice the error message because the Windows Installer service uses the SYSTEM account to install software.
The SYSTEM account has Full Control on the drive and all folders.
Please advise...
Have you tried using PSEXEC? or are you using powershell for a reason? I find that easier for remote installs than trying to go through powershell.
Just PSEXEC into the server CMD. Copy the files locally then run MSIExec to install.
I ended up writing a second PowerShell script that runs on the server watching a specific folder for new msi files. The script runs the first script that actually performs the installation tasks.