How to pass a parameter into an EXE to an MSI using powershell
OK, after much trial and all error I have decided to ask for assistance. This is my first post so please be gentle.
I am trying to deploy IBM Data Server Runtime Client 10.5. The issue is that to deploy the application silently you need a response file and the install command for that response file must be an absolute path and not relative. We are using SCCM to deploy the app, which could place it in a different subfolder within CCMCACHE on each machine.
I can hard code a path and the following command works:
- v10.5fp6_ntx64_rtcl_EN.exe /v"/l*v %windir%\Key_Logs\IBM_DATA_SERVER_RUNTIME_CLIENT_10.5fp6_Install.log /qn RSP_FILE_PATH=<hard coded path>\DB2RTC_Install.rsp"
What I am trying to do is use powershell to enumerate the path that the response file resides in when placed in CCMCACHE (also the location where the powershell command would be run from). I have tried many different ways to do this, but they all seem to fail. Obviously my powershell skills are lacking or my understanding is not sufficient to make it work.
Here is what I am working around. Like I have said, I have tried many different iterations around this script, like variablizing most of the commands
#This script is required because the installation of the DB2 Runtime client will not accept relative paths to the response file
#We need to enumerate the relative path as a variable and pass the variable into the RSP_FILE_PATH= argument.
$SourceDir = (Get-Item -Path ".\" -Verbose).FullName #determines what SCCM folder install files are in
Start-Process -FilePath "$SourceDir\v10.5fp6_ntx64_rtcl_EN.exe" -ArgumentList '/v" /l*v %windir%\Key_Logs\DB2RTC_10.5Fp6_Install.log /qn RSP_FILE_PATH=' + $SourceDir + '\DB2RTC_Install.rsp"' -Wait
Any help would be greatly appreciated
Answer Chosen by the Author
The reason I ask is that Oracle uses .rsp files, and they capture the location that the .rsp file was created in, in the file itself.
You have to modify a FROM_LOCATION to a relative path otherwise it will only install from the path the .rsp was created in - see this post for more information - your .rsp file may be different, but it's worth bearing in mind.
How about a simple batch file to confirm your approach is correct? %~dp0 will give you the current path: