I'm having trouble with a piece of code that I'm trying to get working in regards to executing an MSI application. I need to pass credentials that are stored in a variable and then pass those credentials through a "runas" to the MSI package so that it is installed with the escalated credentials I pass to the application.
Here is the section of code I am having trouble with.
if($filter -like "*.msi")
{
Start-Process -FilePath "msiexec $FullFilePath" -Credential $adminCreds -ArgumentList "-noprofile -command &{Start-Process /i $FullFilePath /passive /norestart -verb runas}" -Wait -WorkingDirectory $path
exit
}
My variables are as follows:
$filter = Get-ChildItem $path -Filter $($installer[$i]) -name
$FullFilePath = $path + "\" + $filter
$path = Split-Path $script:MyInvocation.MyCommand.Path
Thanks in advance!