KThorlund
Enthusiast
Enthusiast

PowerNSX / Invoke-NsxRestMethod / Error Code 202 / Object Not Found

Jump to solution

Hello,

I have downloaded the latest PowerNSX from the PSGallery, and got it up running. I can read the applied security tags on many of my machines.

But on many of my machines it fails. NSX is configured, and I can view and edit the security tags in the vSphere client.

By code I read it as such:

$VM | Get-NsxSecurityTagAssignment | select-object @{Name="SecurityTag"; expression = {$_.securitytag.name}}, VirtualMachine

The script fails when calling Get-NsxSecurityTagAssignment:

!! System.Management.Automation.RuntimeException

!! Invoke-NsxRestMethod : The NSX API response received indicates a failure. 404 : Not Found : Response Body: {"errorCode":202,"details":"The requested object : vm-577231 could not be found. Object identifiers are case sensitive.","rootCauseString":null,"moduleName":"core-services","errorData":null}

!! Line: 4126

I can see any different on neither VM or host.

Can anyone guide me in a direction where to look. What object is it, it cant find - what is it, which can find it..

I got the actual VM object, and I kan query it directly with PowerCLI, but not PowerNSX.

Any suggestions to 404 Not Found, Error 202 and Requested object not found (from where and by whom..)?

Regards Kjeld

0 Kudos
1 Solution

Accepted Solutions
KThorlund
Enthusiast
Enthusiast

I have figured out what was wrong. My own fault. I was connecting to the wrong NSX manager when checking the VM.

Using aligned vCenter, NSX Manager and VM fixed the issue.

I got my Security Tags as expected.

View solution in original post

0 Kudos
1 Reply
KThorlund
Enthusiast
Enthusiast

I have figured out what was wrong. My own fault. I was connecting to the wrong NSX manager when checking the VM.

Using aligned vCenter, NSX Manager and VM fixed the issue.

I got my Security Tags as expected.

View solution in original post

0 Kudos