Tag Info

New answers tagged

1

After a long day, it turned out that for successfully using the Powershell DownloadFile() method, in my environment (SP2013 with ADFS) following two lines did the trick(at least for me). $wc.UseDefaultCredentials = $true $wc.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f") So, the final code looks like, $FilePath = ...


1

Try this $wc = New-Object System.Net.WebClient $wc = New-Object System.Net.Networkcredential(Username, Password) $UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)" $wc.Headers.Add([System.Net.HttpRequestHeader]::UserAgent, $UserAgent);



Top 50 recent answers are included