Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8929361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:39:28+00:00 2026-06-15T08:39:28+00:00

I am trying to setup to download need files to automate and install process.

  • 0

I am trying to setup to download need files to automate and install process. I keep getting errors ever time I run the script and I have changed it seven ways from sunday and it still gives me errors.

The script is:

  if (test-path $java_path)

   {
   Write-Output "Java already installed. Skipping script"
   exit 0
    }

  else 

    {
      $source = "http://our.server.com/java-installer.zip"
      $destination = "c:\CHPACS"
      $client = new-object System.Net.WebClient
      $client.DownloadFile($source, $destination)

      }

The error message that I am getting is

 Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
 At C:\ps_script\testjava.ps1:41 char:31
 +           $client.DownloadFile <<<< ($source, $destination)
 + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
 + FullyQualifiedErrorId : DotNetMethodException

Do I need to create a function to make this work properly?

Thank you:

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:39:29+00:00Added an answer on June 15, 2026 at 8:39 am

    If you look at the MSDN documentation for the DownloadFile method, you’ll notice that the second parameter is a filename, not a directory. So, if you re-define $destination to something like:

    $destination = "c:\CHPACS\java-installer.zip"
    

    then it should work.

    Check secondly that the file that you’re trying to download isn’t open or being executed at the moment. This exception will be raised if the file is in use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have customers who are trying to download a setup.exe file over mobile connections
I am trying to setup progressive download of an mp4 file from aws cloudfront
I'm trying to download Eclipse IDE for Android development. I've downloaded the setup but
I'm trying to install cygwin on my Windows 7 machine. I get the setup
I am trying to setup a build on our Jenkins server to run a
I am trying to install the OpenGL-2.4.0.2 package manually, but after I download the
I am trying to set up a NSURLRequest to download a simple index.html with
Trying to setup a personal image upload/downloader webpage. I've viewed the msdn article on
Trying to setup a CodeIgniter based project for local development (LAMP stack), and once
Trying to setup some validation on the add to cart button for the dropdown

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.