In the example, we just download the HTML page that the web server at generates. To simply download a file through HTTP, you can use this command: Invoke-WebRequest -Uri '' -OutFile 'C:\path\file' This is perhaps an understatement Invoke-WebRequest is more powerful than wget because it allows you to not only download files but also parse them. It is PowerShell’s counterpart to GNU wget, a popular tool in the Linux world, which is probably the reason Microsoft decided to use its name as an alias for Invoke-WebRequest. $WebClient.DownloadFile('','C:\path\file')Īs of PowerShell 3, we have the Invoke-WebRequest cmdlet, which is more convenient to work with.
In PowerShell 2, you had to use the New-Object cmdlet for this purpose: $WebClient = New-Object The next simple case is where you have to download a file from the web or from an FTP server.
Things get a bit more complicated if we are leaving the intranet and have to download from an extranet or the Internet. This assumes that you have a VPN solution in place so that your cloud network virtually belongs to your intranet. Copy-Item -Source \\server\share\file -Destination C:\path\