Quantcast
Channel: Configuration Manager 2007 Software Distribution forum
Viewing all articles
Browse latest Browse all 629

Script that runs MSI from discovered location.

$
0
0

Hello everyone -

Still a noob here in scripting with powershell...

We use SCCM 2012, and i'd like a script that can parse through the ccmCache folder, find the desired MSI, and the use this path to work from(parameters, etc).

Below is what i have attempted, but to no avail.
When running the below...i get the  T h i s   i n s t a l l a t i o n   p a c k a g e   c a n n o t   b e   o p e n e d  message in the script output...further telling me that the msi cannot be found.

The purpose of this is to wrap together a "find app version" script before the below script, so where it can back out if the desired version is already installed(we have a lot of image drift in with certain apps at my company).
I know its something im missing...and ideas?
TIA

$PathtoInstall = Get-ChildItem -Path C:\windows\ccmcache\ "jre1.7.0_05-c.msi" -Recurse

Foreach ($File in $PathtoInstall) {

    If ($File.Exists)  {


      
        $install = $File.Name
        & cmd /c "c:\windows\system32\msiexec.exe /i" $Install

}

}


Viewing all articles
Browse latest Browse all 629

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>