- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Access support files in powershell actions
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
Access support files in powershell actions
I have provided a set of support files (DOS batch files).
I need to run these script and I intend to do this through a powershell script action.Does anyone know how I can get the path to the support files folder I have declared ?
I have tried this without success:$install_level = Get-Property -name INSTALLLEVEL
$target_dir = Get-Property -name TARGETDIR
$install_dir = Get-Property -name INSTALLDIR
$setup_exe_dir = Get-Property -name SUPPORTDIR # <<< this returns nothing
Anybody ?
---- the script looks like this ---
Get-Date | Out-File -FilePath d:\test-power-shell.txt
trace-info "Running Post install actions..."
$trace_name = "[Post install actions] "
$exit_code = 99
$install_level = Get-Property -name INSTALLLEVEL
$target_dir = Get-Property -name TARGETDIR
$install_dir = Get-Property -name INSTALLDIR
$setup_exe_dir = Get-Property -name SUPPORTDIR
function batch_file_runner([string]$batch_script){
$batch_file = "$setup_exe_dir\Support Files\$batch_script"
# -windowstyle 'Hidden'
if ( Test-Path $batch_file ){
trace-info "$trace_name running: $batch_file"
Start-Process -wait $batch_file "nopause"
if ($?){
trace-info "$trace_name $batch_file done..."
} else {
throw "Command-let Start-Process failed while running $batch_file"
}
} else {
throw "Failed to find batch script $batch_file"
}
}
echo "Install level: $install_level, Setup dir: $setup_exe_dir, Target dir: $target_dir, Install dir: $install_dir" | Out-File -append -FilePath d:\test-power-shell.txt
trace-info "Before try catch section Install level: $install_level, Setup dir: $setup_exe_dir, Target dir: $target_dir, Install dir: $install_dir"
try {
trace-info "$trace_name running: Start running"
batch_file_runner("mock-configuratoin-batch.bat")
$exit_code = 0
} catch {
trace-info "$trace_name running: script failed. $_.Exception.Message"
}
trace-info "$trace_name running: getting out of the try catch section"
exit($exit_code)
Below command should work. Make sure you have files added\present under Support Files view in your Basic Msi project in order to access this variable.
Get-Property -name SUPPORTDIR
Now , this exactly what I'm already doing and doesn't work. Do you know if this variable/property is set after a specific sequence step ?
This is what you're suggestion returns:
PowerShell wrapper: Hello world : Install level: 10, support dir: , Target dir: D:\, Install dir: D:\CTSS\
PowerShell wrapper: Hello world : return 9999
As you can see, it's empty !
The poserscrip I'm running looks like this:
$install_level = Get-Property -name INSTALLLEVEL $target_dir = Get-Property -name TARGETDIR $install_dir = Get-Property -name INSTALLDIR $setup_exe_dir = Get-Property -name SUPPORTDIR $herbert = Get-Property -name HERBERT trace-info "$herbert : Install level: $install_level, support dir: $setup_exe_dir, Target dir: $target_dir, Install dir: $install_dir" trace-info "$herbert : return 9999" exit (9999)
The "Hello world" was set throught the property manager editor. It's working (get-properety -name HERBERT). The other properties install shield properties are also valorized as expected.
Attached, the MSI log with more informations
FYI, this variables is only set if you add files in "Support Files" -> "Language Independent" or "French" (when language dependent.
If you add files into "Advanced files" -> "DISK1", then the variable is NOT set.