Created
December 15, 2014 15:35
-
-
Save pfmoore/8c8e7a0b80ee2d412657 to your computer and use it in GitHub Desktop.
Useful Powershell Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use this one to load this snippet :-) | |
function Invoke-URLContent ($url) { | |
(New-Object Net.WebClient).DownloadString($url) | Invoke-Expression | |
} | |
function Get-URLContent ($url, $path) { | |
if (!$path) { | |
$path = Join-Path $pwd.Path ([URI]$url).Segments[-1] | |
} | |
(New-Object Net.WebClient).DownloadFile($url, $path) | |
} | |
# Need to run this once if your connection needs proxy authentication | |
function Set-ProxyAuthentication { | |
$wc = New-Object Net.WebClient | |
$wc.UseDefaultCredentials = $true | |
$wc.Proxy.Credentials = $wc.Credentials | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment