Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

use Powershell to install an MSI located on a web site with a username pwd

Posted on 2014-03-24
6
Medium Priority
?
286 Views
Last Modified: 2014-04-25
I have an MSI located on a web site that is secured with a basic username/pwd.

I need to use powershell to install it on a local server.
What syntax do I need to use for that?

here is what I have tried:
A) msiexec /i "https://Mysite.myserver.com/Myinstall.msi"
B) start-process -filepath msiexec.exe -argumentlist "/i https://Mysite.myserver.com/Myinstall.msi"

Each time I run these it tells me it can't locate the MSI. I suspect it is because of the username/pwd on the web site.

Ideas?
0
Comment
Question by:JasonLattin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 19

Accepted Solution

by:
Raheman M. Abdul earned 2000 total points
ID: 39951912
Try this:

$source = "https://Mysite.myserver.com/Myinstall.msi"

$destination = "c:\temp\Myinstall.msi"

$userid="usernameHere"

$passwd="passwordHere"


$client = New-Object System.Net.Webclient

$client.Credentials = New-Object System.Net.NetworkCredential($userid,$passwd)

$client.DownloadFile($source, $destination)

# Wait until file downloaded.
Start-Sleep -Seconds 10  

while(!(Test-Path $destination)) {
  Start-Sleep -Seconds 10;
 }

msiexec /i $destination
0
 

Author Comment

by:JasonLattin
ID: 39952258
@Raheman
Your script works fine if the file is on a regular http site but it fails on an https site. My site is secured with a certificate, requiring https.

Ideas?
0
 

Author Comment

by:JasonLattin
ID: 39952268
@Raheman
Further testing shows that it isnt the certificate / https that is breaking the script. It seems to be my username/pwd on that site. If I open the site to not require a username/pwd then your script works like a charm.
Just need to figure out how to address the username/pwd issue for the site.
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 39952729
For that the page source is required then we can parse and use the login details to enter to the site. otherwise we can use sendkeys()
is that externall site or internal site?
0
 

Author Comment

by:JasonLattin
ID: 39953239
@Raheman
The MSI is on an external web site. it never prompts for login so i'm not sure how sendkeys() will work but i am sure you have other thoughts.
0
 

Author Closing Comment

by:JasonLattin
ID: 40022632
This works like a charm. Does not work for HTTPS sites but for regular sites it works fine.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question