Am trying to pass the following two arguements to MsiExec.exe through a PS
script:
/I{C8B0680B-CDAE-4809-9F91-387B6DE00F7C}
and...
/l+weaom $LOGFILE
Code as follows:
-----CODE START-----------------------------------------------------------
Clear-Host
#
# (c) 2009 DNC Inc.
# -------------------------------------------------------------
#
# 1/05/2009 SReed INITIAL CREATION
#
# -------------------------------------------------------------
#
$THIS_CMD = "RoxioEMC9Removal"
#
$TEMP = "C:\Temp\$THIS_CMD"
$CHECK_DIR = Test-Path "$TEMP"
switch($CHECK_DIR)
{
"True"
{
}
"False"
{
New-Item -path C:\ -name "Temp\$THIS_CMD" -type directory > null
}
}
#
$LOGFILE = "$TEMP\$THIS_CMD.log"
$CHECK_LOG = Test-Path "$LOGFILE"
switch($CHECK_LOG)
{
"True"
{
Remove-Item "$LOGFILE"
}
"False"
{
}
}
#
$APPLICATION = "C:\Windows\SYSTEM32\MsiExec.exe"
$LOGARG = "/l+weaom $LOGFILE"
#
# Sets the window title
$Host.UI.RawUI.WindowTitle = "$THIS_CMD"
#
Write-Output "REMOVING Roxio Creator Basic v9..."
Write-Output " "
$ARGUMENTS = "/I{C8B0680B-CDAE-4809-9F91-387B6DE00F7C} $LOGARG"
$EXECUTE_APP = "$APPLICATION $ARGUMENTS"
Write-Output "APP: $APPLICATION"
Write-Output "ARGS: $ARGUMENTS"
Write-Output "LOG: $LOGARG"
Write-Output "EXEC: $EXECUTE_APP"
& $APPLICATION $ARGUMENTS
#
-----CODE END-----------------------------------------------------------
When executed as is, MsiExec.exe displays its help window. This is NOT what
I want.
When I pull the $LOGARG from the $ARGUMENTS it runs as expected and begins
the uninstallation of the product component referenced.
This is a migration to Powershell of an old NT Batch CMD that I have which
references the same MsiExec.exe arguements and runs without any trouble at
all.
I have used Echoargs.exe and it shows me valid arguements being passed.
Anyone have any ideas?
Scott
This works great... i'm sure someone can tailor this to their needs to.
----- START CODE -----
$LOGFILE = "C:\Temp\SomeFile.log"
$Application = "MsiExec.exe"
$LogArg = "/l+weaom $LOGFILE"
Write-Output "REMOVING Roxio Creator Basic v9..."
Write-Output " "
$ProdID = "/I{C8B0680B-CDAE-4809-9F91-387B6DE00F7C}"
$Uninstall = [Diagnostics.Process]::Start("$Application","$ProdID $LogArg")
$Uninstall.WaitForExit()
----- E N D CODE -----