Forum Discussion
Sharepoint 2013 and Powershell
People, clearly you need an incentive to answer my question. I have a Friends and Family discount code for Columbia Sportswear's website and its family of brands (Sorel, Mountain Hardwear, Prana).
- Feb 27, 2018Lol :-)
Can you share the PoSh you're using today? I mean, this works:
wget https://sharepoint.example.com/sites/siteName/DocLibName/myFile.xlsx -UseDefaultCredentials:$true- DeletedFeb 27, 2018
I'm trying to download a file from our on-premise Sharepoint site. If I use the PS code below, the file downloads OK - either using the default creds (under my user account) or if I explicitly enter my creds using get-credential.
Invoke-WebRequest -uri $fromfile1 -outfile $tofile1 -UseDefaultCredential
Invoke-WebRequest -uri $fromfile1 -outfile $tofile1 -Credential (Get-Credential)
But I need to have this code run under the local system account. When I enter my creds using get-credential - the same as above - in a PS window running under local system, I get:
Invoke-WebRequest : 401 UNAUTHORIZED
- Feb 27, 2018In that case, it looks like you just don't have permission or your URL to the file is incorrect. You can use Fiddler to trace the web request. Otherwise your cmdlet is correct.