Search code examples
powershellitunespowershell-4.0

Installing multiple iTunes MSI in Powershell App Deployment Toolkit


I have been told that I must deploy iTunes across PSADT, to Windows machines. I do not want to run the full .exe and would rather deploy the individual MSI files.

$msi = @("$dirFiles\iTunes 64iTunes6464.msi", "$dirFiles\AppleApplicationSupport64.msi", "$dirFiles\Bonjour64.msi")
        foreach($_ in $msi)
        {Start-Process -FilePath msiexec -ArgumentList /i, $_, /passive -Wait}

It is picking up the array and is cycling through but I am getting Parameter errors on each file. New to PS and the various different requirements of each app is completely throwing me.

Is there something stupidly obvious I am missing, or am I barking up the wrong tree with the script construct?


Solution

  • -ArgumentList takes a string, or string array - so you'll need to use something like the below.

    $ToInstall = ("iTunes 64iTunes6464.msi", "AppleApplicationSupport64.msi", "Bonjour64.msi")
    foreach($Msi in $ToInstall){
        Start-Process -FilePath 'msiexec' -ArgumentList "/i ""$($dirFiles + '\' + $Msi)"" /passive" -Wait
    }
    

    currently it's trying to convert things after the -ArgumentList into a string, but doesn't know where to stop.

    let me know if that works for you.