0

I have written 2 scripts. One in python and one in powershell. Python is able to call a rest api and is returned the string "JSESSIONID=8kfv0fi1bc84gtw2xvnqsrt4;Path=/;Secure;HttpOnly ". When I use the following code in powershell, it returns "success". What am I doing wrong?

$getEncCode = "Er6TmdhXn09Y9C1I"
$dataPart1 = @{EncCode=$getEncCode}
$dataPart = $dataPart1 | ConvertTo-Json                  
$uri = "https://10.164.42.77:8092/getEnc/2252953/login"                   
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12                   
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

$result = Invoke-RestMethod -Method Post -Body $dataPart -uri $uri  -ContentType "application/json"
Write-Host $result
AVI
  • 5,516
  • 5
  • 29
  • 38
KenM
  • 1
  • Tempting Dup: https://stackoverflow.com/questions/15792650/printing-object-properties-in-powershell – Matt Mar 15 '18 at 12:47

1 Answers1

0

Write-Host $result uses the $result.ToString() method to display that object as a string.

Likely there is more data there to show. Simply remove Write-Host to see it. Or do something like Get-Member -InputObject $result to see all immediate properties, methods etc.

Have a look at Printing object properties in Powershell to see other ways to deal with this.

Matt
  • 45,022
  • 8
  • 78
  • 119