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 开发者_StackOverflow中文版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.
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"
精彩评论