locked
401 Unauthorized error when executing PS script for SharePoint Site RRS feed

  • Question

  • I receive a 401 unauthorized error when I execute the following statements

    cls
    $webclient = New-Object Net.WebClient
            if($webclient.Proxy -ne $null)
            {
    
                    $webClient.UseDefaultCredentials = $true
            }
    $webclient.DownloadString("http://thistest2.com")

    I don't have access to this site so I understand why I have received the error message.
    If I test this site,thistest2.com, which I don't have access to I am able to download the webpage without any errors. On the webpage, there is "Error: Access denied error" 
    Any reasons why that is the case?
    Why thistest1.com failed but thistest1.com passed?

    Thursday, January 30, 2014 4:52 AM

Answers

  • you have to run the shell using ur farm admin account

    Whenever you see a reply and if you think is helpful, click "Alternate TextVote As Helpful"! And whenever you see a reply being an answer to the question of the thread, click "Alternate TextMark As Answer

    Friday, January 31, 2014 4:40 PM

All replies

  • you have to run the shell using ur farm admin account

    Whenever you see a reply and if you think is helpful, click "Alternate TextVote As Helpful"! And whenever you see a reply being an answer to the question of the thread, click "Alternate TextMark As Answer

    Friday, January 31, 2014 4:40 PM
  • on which server / computer you are running the script?

    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

    Friday, January 31, 2014 5:17 PM