I believe this is a command issue, but I am paving the the issue with an explanation.
When I am in PSS the .cmd and .bat files popup in a prompt box, run, then exit, but I get no visual sign of anything executing after packaging msi files.
I cannot get MSI external files to execute.
I went through the tab settings of the MSI packager.
Really, mostly took the defaults.
The program installs in:
C:\Program Files\Company\Product
Like:
C:\Program Files\Adobe\Photoshop
Apparently PPS does not create the sub-folder structure but dumps all the files in the root product name folder.OK, I can deal with that.
What I would like to know is how do I correctly point the button commands to execute the external files? The files are .cmd, .bat, and a few others but I think if I were given 1 good working example, I might be able to figure the rest out.
When pointing to the files from within PSS I can use multiple ways and they launch: Call & , Start-Process, Invoke-Item, etc... but literally after doing the packaging MSI and installing everything that is an external file does not launch.
Anything that is a windows internal tool, a windows native utility, powershell commands all work.
There is something important that I am trying to accomplish in that I do not desire full hard paths. I am trying to be able to have my path detect at folder product which would be my root folder of script and external files. That way the folder can be installed via MSI, or I can package it in a zip and it will work wherever it is extracted at.
I've tried these type examples:
Code: Select all
$buttonDisableStartupRepair_Click={
#TODO: Place custom script here
$richtextbox1.Text =
# Invoke-Item -Path
# Start-Process -FilePath
Start-Process -FilePath "$PSScriptRoot\Bat\DisableStartupRepair.Bat" -PassThru | Out-String
}
$buttonGetWindowsUpdates_Click= {
#TODO: Place custom script here
$richtextbox1.Text =
#invoke-expression 'cmd /c start powershell -NoExit -Command ".\\ImportPs1\AutoWinUpdates.ps1"' | Out-String
Start-Job -ScriptBlock { . $PSSriptroot\ImportPs1\AutoWinUpdates.ps1 } -Name 'WinUpdates' | Out-String
#Start-Job -ScriptBlock { . .\ImportPs1\AutoWinUpdates.ps1 | Out-String }
}
$buttonUpdateMcAfeeVirusDef_Click={
#TODO: Place custom script here
$richtextbox1.Text =
# Invoke-Item -Path ".\Bat\McAfeeUpdater.cmd"
Invoke-Item -Path "McAfeeUpdater.cmd" | Out-String
}
$buttonRunCFGMGRActionItems_Click={
#TODO: Place custom script here
$richtextbox1.Text =
Start-Process -FilePath "$PSScriptRoot\CfgMgrActionItems.cmd" -PassThru | Out-String
# Invoke-Item -Path ".\Bat\CfgMgrActionItems\CfgMgrActionItems.cmd"
}