- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think this line 136 is wrong, in 2 ways. The POST and the Error is not a real function
try { $token = Invoke-WebRequest -Uri "$emaServerURL/api/$emaAPIVersion/accessTokens/getUsingWindowsCredentials" -UseBasicParsing -Method Post -Body $creds | Write-RESTResponseVerbose | ConvertFrom-Json } catch { Write-RESTAPIErrorVerbose $_ }
I think the line should be
try { $token = Invoke-WebRequest -Uri "$emaServerURL/api/$emaAPIVersion/accessTokens/getUsingWindowsCredentials" -UseBasicParsing -Method Get -Credential $psCreds | Write-RESTResponseVerbose | ConvertFrom-Json } catch { Write-RESTErrorVerbose $_ }
My line works and is tested.
Your line returned this error:
Invoke-WebRequest : {"Message":"The request is invalid.","ModelState":{"windowsCredential.Upn":["The Upn field is not
a valid e-mail address."]}}
At \\alpinedental.com\scripts\Clients\AMT\Sample Scripts 1_7\PowerShell\Example
Scripts\Adopt-AMTSetupByEndpointList.ps1:136 char:28
+ ... { $token = Invoke-WebRequest -Uri "$emaServerURL/api/$emaAPIVersion/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
a valid e-mail address."]}}
At \\alpinedental.com\scripts\Clients\AMT\Sample Scripts 1_7\PowerShell\Example
Scripts\Adopt-AMTSetupByEndpointList.ps1:136 char:28
+ ... { $token = Invoke-WebRequest -Uri "$emaServerURL/api/$emaAPIVersion/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is SAMPLE scripts v1.7.
Title contained typo SAME Scripts
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page