homotechsual / HaloAPI

PowerShell module for the Halo Service Solutions series of software products.
MIT License
48 stars 38 forks source link

[Bug]: Operation is not valid due to the current state of the object. - Updating Site #37

Closed ItsNotDNS closed 3 months ago

ItsNotDNS commented 8 months ago

Contact Details

david.d.b.laycock@gmail.com

What happened?

I am currently dealing with an issue where I have ~300 sites in Halo that are missing the property of 'name'. With HaloAPI I've been able to create a list of all of these problem sites and am attempting to create the property of 'name' for each objects, set the name to be the same as the site ID and then push that modified object back into Halo.

Shown in the image below is the test site I am using. It was originally missing the property of name. Using the Add-Member cmdlet I added a 'name' with a value of '1323'. When using Set-HaloSite I get the error. I've looked around for some examples of Set-HaloSite but I haven't been able to find a utilization of this command. Also my powershell-fu is weak so I may be missing something obvious. From what I've looked through it seems like I should be passing the command an object that contains the site ID and whatever other fields I want to update.

image

Version

1.20.0

Which operating systems have you tested on?

What PowerShell version are you running?

7.4.1

Halo Product

Halo PSA

Halo Version

2.132.54

What command did you run?

Set-HaloSite $test

What was the output of the command?

Exception: C:\Users\Username\OneDrive\Documents\PowerShell\Modules\HaloAPI\1.20.0\Private\New-HaloError.ps1:65
Line |
  65 |          throw $ErrorRecord.Exception.Message
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Operation is not valid due to the current state of the object.
homotechsual commented 3 months ago

This should have been resolved now - it was an issue in the background with Halo vs PowerShell 7.4.0