Hi
System:
Using Powershell 5.0 on server 2012R2
What I want:
I want to access/load (from another server) a IIS site which is using kerberos authentication through PowerShell. I want to do this because I want the IIS Server that is hosting the site to add an Event Viewer 4624 Security message that tells me if I authenticated
using Kerberos or not.
What Works:
I can remotely (from another domain joined server in PowerShell) access the site from a server via:
$SiteURL= "web.contoso.com"
Invoke-WebRequest -Uri $SiteURL -SessionVariable websession -UseDefaultCredentials
Problem:
How can i run the same Invoke-WebRequest with another domain credential ($UseThisCredential)? Like so:
Invoke-WebRequest -Uri $SiteURL -Credential $UseThisCredential -SessionVariable websession
This gives me the error:
Invoke-WebRequest : 401 UNAUTHORIZED
At line:1 char:2
+ Invoke-WebRequest -Uri $SiteURL -Credential $UseThisCredential -Sess ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Any tips are welcome:-)
brgs
Bjørn