Abe Miessler
Abe Miessler

Reputation: 85056

Possible to download/add a snapin from PowerShell?

I am writing a script that uses the Quest ActiveRoles Management Shell and I plan on handing this off to other people I work with to use. Before I started using this snapin on my Dev machine I had to go to their website, download the MSI, install it and then use Add-PSSnapin to make it available.

Is there anyways I can include these steps in my script so that users don't have to do it themselves? Seems like it is a big security risk, so I'm not sure if it can even be done.

Upvotes: 2

Views: 134

Answers (1)

Mike Shepard
Mike Shepard

Reputation: 18156

I agree that it sounds like a bit of a security risk. Have you tried simply automating the steps? This should get you started. (Note that you'll have to provide values for the variables)

Download the installer:

$web=new-object net.webclient
$web.DownloadFile($URL,$tempdirectory)

Run the installer:

& "$tempdirectory\$nameofmsifile"

Add the snapin

add-pssnapin "Name of Snapin"

Upvotes: 1

Related Questions