PowerShellでOrchestratorのRobot一覧を取得したいのですが、エラーが発生しました。
どこを直したらよいか教えてください。
【PowerShell】
$uriAccount = “$uriOrch/api/Account”
$bodyAccount = @{
“tenancyName” = $tenantName
“usernameOrEmailAddress” = $adminName
“password” = $adminPasswd
} | ConvertTo-Json
$contentType = “application/json;charset=utf-8”
WriteLog “Login to [$uriOrch] with Tenant [$tenantName] & Admin [$adminName] …”
$resAccount = Invoke-RestMethod -Uri $uriAccount -Method Post -Body $bodyAccount -ContentType $contentType
$authKey = $resAccount.result
$headers = @{“Authorization”=“Bearer $authKey”
$resRobots = Invoke-RestMethod -Uri $uriOrch/odata/Robots -Method Get -ContentType $contentType -Headers $headers
$resRobots.value | foreach {$_.Name}
【Error】
Invoke-RestMethod : {“message”:“このアクションには組織単位が必要です。”,“errorCode”:1101,“resourceIds”:null}
発生場所 行:60 文字:14
- … resRobots = Invoke-RestMethod -Uri "$uriOrch/odata/Robots…
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod]、WebException
- FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand