Powershell unable to connect to internet at all -
i have looked everywhere answer this, i'm thinking maybe google ninja skills lacking.
i trying run simple command in powershell downloads string (in reality, want download msi , run - i've narrowed down problem simple example). script running is:
$client = new-object system.net.webclient $client.downloadstring("http://google.com") | out-file google.html
the error is:
exception calling "downloadstring" "1" argument(s): "unable connect remote server" @ line:1 char:1 + $client.downloadstring("http://google.com") | out-file google.html + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : notspecified: (:) [], methodinvocationexception + fullyqualifiederrorid : webexception
psversion = 4.0
i have ran script on colleague's pc (psversion = 3.0) , works perfectly. know code works. have re-created code in c# console application, looks like:
static void main(string[] args) { using(var client = new system.net.webclient()) { var content = client.downloadstring("http://google.com"); file.writealltext("d:\\google.html", content); } }
and works on machine - know it's not .net framework that's problem. , weirdly, can make call exe
powershell , works.
i have narrowed down being problem powershell, cannot life of me work out what. have done machine in order break powershell's connection internet, knows more me happens behind scenes.
please note has nothing ps remoting. don't think, i'm not trying use ps remoting. don't think...
are running powershell different account (for example admin)? maybe account's proxy settings different normal account's? maybe try setting $client.proxy = $null before downloading , see if helps.
Comments
Post a Comment