0

如何添加System.collection.Generic.Dictionary[[String],[String]]到以下函数(在内部$InvokeRestMethodsplat):

Function ADD-DevicesToDiscovery{
param($Token)
$nburi = 'htts://myuri'

$body = "{
`n  `"seeds`": [
`n    {
`n      `"mgmtIP`": `"10.1.1.2`"
`n    }
`n  ]
`n}"

    Try {   
         $InvokeRestMethodsplat = @{
            Uri         =  $nbUri
            ContentType = 'Application/json'
            ErrorAction = 'Stop'
            Method      = 'Post'
            Body        =  $body
            Headers     = @{ Token = $netbrainToken; 'accept' = 'application/json'}
                         
            
            }
       $response = Invoke-RestMethod @InvokeRestMethodsplat
       $response | ConvertTo-Json
    } 
    catch {
        Write-Error $_
    }
return $response
}
4

0 回答 0