Created
March 21, 2019 15:17
-
-
Save phaniav/0dbf8a292fa88ec48d29c6ce0e116de0 to your computer and use it in GitHub Desktop.
PowerShell snippet to login to Sitecore using Invoke-WebRequest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
$url = 'https://sitecore-cm.domain.com/sitecore/login' | |
$password = 'yourpasseordhere' | |
$Body = @{ | |
User = 'username' | |
password = $password | |
} | |
$LoginResponse = Invoke-WebRequest -Uri -Method Post -Headers @{"Content-Type" = "application/x-www-form-urlencoded"} ` | |
-Body $Body -SessionVariable 'Session' | |
$Session | |
$LoginResponse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment