Intel vPro® Platform
Intel Manageability Forum for Intel® EMA, AMT, SCS & Manageability Commander
2942 Discussions

Same Scripts Error - Powershell - Adopt-AMTSetupByEndpointList.ps1

JonV
Beginner
606 Views

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
0 Kudos
1 Reply
JonV
Beginner
605 Views

This is SAMPLE scripts v1.7.

 

Title contained typo SAME Scripts

0 Kudos
Reply