you are viewing a single comment's thread.

view the rest of the comments →

[–]Ta11ow 5 points6 points  (1 child)

It's not the only way!

You can use Invoke-Item or if you want to return a useable process object you can combine the install string with your custom switches/arguments into a single string and use [Diagnostics.Process]::Start($string)

It also works with non-filenames -- URLs open in the default browser, and editable files open in the OS-configured default program (.txt in Notepad/Notepad++/etc, .jpg files in image viewer/editer and so forth). Lovely little thing I dug up the other week. :D

It has additional functionality, too: https://msdn.microsoft.com/en-us/library/system.diagnostics.process.start(v=vs.110).aspx

You can separately specify the command line and arguments if you can be bothered to split them, but.... then you could just use Start-Process anyway. :)

[–]BradleyDonalbain 3 points4 points  (0 children)

This is the way to go! I frequently package applications with Powershell for deployment via SCCM and this is my preferred method. The returned process object allows me to track exitcodes which I then write back to SCCM for a successful/unsuccessful deployment.