Advertisement
Guest User

Untitled

a guest
Sep 1st, 2018
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $strBase     = "http://url/download/"
  2. $strFileBase = "filename"
  3. $aExtensions = ".exe",".aaa",".bbb",".ccc"
  4.  
  5. foreach ($ext in $aExtensions)
  6. {
  7.    try
  8.    {
  9.     $a = Invoke-WebRequest -Uri $($strBase + $strFileBase + $ext) -OutFile $($strFileBase + $ext)
  10.     write-host  $strBase$strFileBase$ext "downloaded to" $strFileBase$ext
  11.    }
  12.    catch
  13.    {
  14.     $strBase + $strFileBase + $ext + " doesn't exist on server."
  15.    }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement