Create script with powershell to download binary files,,

Welcome Forums General PowerShell Q&A Create script with powershell to download binary files,,

This topic contains 2 replies, has 3 voices, and was last updated by

 
Participant
5 days, 10 hours ago.

  • Author
    Posts
  • #128352

    Participant
    Points: 12
    Rank: Member

    Dear All,

    Kindly I need your help. What is the best practice to create power shell script to download binary files from github and deploy it on IIS.

    Regards,
    Ahmad

     

     

  • #128395

    Participant
    Points: 832
    Helping Hand
    Rank: Major Contributor

    You could better write something and post here, it will be easy for us to advice by looking your code.

  • #128578

    Participant
    Points: 316
    Helping Hand
    Rank: Contributor

    This comes off as you are very new to PowerShell, and if that is the case, please take the time to ramp up using all the freely available resources to get you there, as to avoid all the confusion a frustration you are going to encounter. See this series of Q&A's for a very long list of all the freely available information.

    'https://social.technet.microsoft.com/wiki/contents/articles/183.windows-powershell-survival-guide.aspx'
    'https://mva.microsoft.com/training-topics/powershell#!jobf=IT%20Pros&lang=1033'
    'https://www.reddit.com/r/PowerShell/comments/95y82g/whats_the_best_youtube_powershell_tutorial_series'
    'https://www.reddit.com/r/PowerShell/comments/98dw5v/need_beginner_level_script_ideas_to_learn'
    'https://www.reddit.com/r/PowerShell/comments/7oir35/help_with_teaching_others_powershell'
    'https://www.reddit.com/r/PowerShell/comments/9apwyo/i_want_to_convince_my_managers_to_enable_ps'
    'https://www.reddit.com/r/PowerShell/comments/98qkzn/powershell_advice'
    'https://www.reddit.com/r/PowerShell/comments/96rn7y/college_level_student_looking_for_a_good_online'
    'https://www.reddit.com/r/PowerShell/comments/99dc5d/powershell_for_a_noob'
    'https://blogs.technet.microsoft.com/heyscriptingguy'
    'https://adventofcode.com'
    'https://www.thecodeasylum.com'

    As for your query... Downloading files is a common thing using PowerShell and fully documented by Microsoft via TechNet, and the MS docs site, as well as in the PowerShell help file examples and all over the web.

    Using Windows PowerShell to Create BITS Transfer Jobs

    Leverage BITS for File Transfers with PowerShell

    All-in-all, just use the BITS cmdlets and just use the help files, and their provided examples in them:

        Get-Command -Name '*bits*'
    
        CommandType Name                   Version     Source                           
        ----------- ----                   -------     ------                           
        Cmdlet      Add-BitsFile           2.0.0.0     BitsTransfer                     
        Cmdlet      Complete-BitsTransfer  2.0.0.0     BitsTransfer                     
        Cmdlet      Get-BitsTransfer       2.0.0.0     BitsTransfer                     
        Cmdlet      Remove-BitsTransfer    2.0.0.0     BitsTransfer                     
        Cmdlet      Resume-BitsTransfer    2.0.0.0     BitsTransfer                     
        Cmdlet      Set-BitsTransfer       2.0.0.0     BitsTransfer                     
        Cmdlet      Start-BitsTransfer     2.0.0.0     BitsTransfer                     
        Cmdlet      Suspend-BitsTransfer   2.0.0.0     BitsTransfer                     
        Application bitsadmin.exe          7.8.17763.1 C:\Windows\system32\bitsadmin.exe
    
    
        Get-Command -Name 'Invoke-*'
    
        CommandType     Name                                               Version    Source
        -----------     ----                                               -------    ------
        ...
        Cmdlet          Invoke-RestMethod                                  3.1.0.0    Microsoft.PowerShell.Utility
        ...
        Cmdlet          Invoke-WebRequest                                  3.1.0.0    Microsoft.PowerShell.Utility 
        ...
    
    
        # Get parameters, examples, full and Online help for a cmdlet or function
        # get function / cmdlet details
        (Get-Command -Name Start-BitsTransfer).Parameters
        Get-help -Name Start-BitsTransfer -Examples
        Get-help -Name Start-BitsTransfer -Full
        Get-help -Name Start-BitsTransfer -Online
    
    
        Get-Help about_*
        Get-Help about_Functions
    
    
        # All Help topics locations
        Get-Help about* | Select Name, Synopsis
    
        Get-Help about* | 
          Select-Object -Property Name, Synopsis |
          Out-GridView -Title 'Select Topic' -OutputMode Multiple |
          ForEach-Object {
            Get-Help -Name $_.Name -ShowWindow
          }
    
        explorer "$pshome\$($Host.CurrentCulture.Name)"
    
    

    3 ways to download files with PowerShell
    https://blog.jourdant.me/post/3-ways-to-download-files-with-powershell

    (PowerShell) HTTP Download any Type of File (binary or text)
    The Download method may be called to download any type of file. It may be a binary file such as a .zip, .pdf, etc., or it may be text (.xml, .txt, etc.). There is no distinction. The Download method downloads the file from the web server and streams it to a file byte-for-byte exactly as received. Any web page may be downloaded in the same fashion. Passing a URL for a page that would normally be viewed in a browser would simply download to a file the HTML delivered by the web server.
    SSL/TLS connections are fully supported by simply specifying a URL that begins with "https://".
    https://www.example-code.com/powershell/http_downloadFile.asp

You must be logged in to reply to this topic.