by 97browng at 2012-09-28 03:44:02
Hi All,by JeffH at 2012-10-01 04:58:03
I have an .msi that I need to install on several computers. Is there any way I can use powershell to do this and then make a report of the successful and unsuccessful installs automatically?
I have the list of PCs in a text file and ideally I would like to just run the powershell script once and for it to run on all machines. I have done something similar via a batch script before but I would like to use powershell now.
For an example lets say I have the below.
* A PC list with each PC name (such as a00000) on a separate line. The file is called PC_list.txt
* I have one text file called Success.txt which should list all the successful installs with a time and date stamp.
* I have one text file called Fail.txt which should list all the unsuccessful installs with a time and date stamp.
Any help would be appreciated.
PowerShell isn’t going to add anything here that you probably couldn’t do in your batch file. It just may make some things easier. For example, you could add Test-Connection to ping the computer and see if it is up. I’m assuming all the computers are running PowerShell v2 with remoting enabled since the install would need to run ON the remote machine. I’m also assuming your msi can be installed per computer for all users. I would take the batch file you’ve used before and start transforming it into PowerShell.by MattG at 2012-10-01 05:10:04
I agree with Jeff. Unfortunately, there are no PowerShell cmdlets or .NET methods that allow you to interact with MSI packages (which I find shocking). For your PowerShell script, you’d basically just need to wrap msiexec.exe. You could certainly wrap the unmanaged functions in msi.dll using P/Invoke, but would be way too much work, prone to error, and you’d be doing Microsoft’s work for them. ;Dby JeffH at 2012-10-01 05:49:39
This is a situation where PowerShell isn’t generally the right tool. I would be looking at Group Policy to push out the app.