Set Computer Description on WMI

Background
I was working on a powershell script that would change the computer description in Active Directory and locally on the computer so that they would both match. I was able to get the AD part easily but the wmi seems to be a challenge. I have tried the following.

What I have Tried
$x = Get-CimInstance Win32_OperatingSystem - Property Description
Set-Ciminstance -InputOjbect $x -Property @{Description=“New Description”} -PassThru

Error
A parameter cannon be found that matches parameter name ‘InputObject’

I have searched different places but haven’t found anything for this specific attribute where someone has gotten it to change. I verified that this value can be set. Any help that can be provided is appreciated.

Instead of -InputObject I think you need to use -CimInstance
The following worked for me

$x = Get-CimInstance Win32_OperatingSystem -Property Description
$x.Description = “My Machine”
Set-CimInstance -CimInstance $x -PassThru

edit: removed pre tags since they seemed to not format correctly.

You can’t modify the description property - its read only

£> $class = Get-CimClass -ClassName Win32_ComputerSystem
£> $class.CimClassProperties[“Description”]

Name : Description
Value :
CimType : String
Flags : Property, ReadOnly, NullValue
Qualifiers : {read}
ReferenceClassName :

@Richard: You did Win32_ComputerSystem I am trying to modify description at Win32_OperatingSystem

@Raymond This worked! Thanks!

Raymond Slieff wrote:
Instead of -InputObject I think you need to use -CimInstance The following worked for me

$x = Get-CimInstance Win32_OperatingSystem -Property Description
$x.Description = “My Machine”
Set-CimInstance -CimInstance $x -PassThru

edit: removed pre tags since they seemed to not format correctly.