Welcome › Forums › General PowerShell Q&A › Set Computer Description on WMI
This topic contains 4 replies, has 3 voices, and was last updated by
-
AuthorPosts
-
October 9, 2014 at 5:44 am #19543
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"} -PassThruError
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.
-
October 9, 2014 at 6:16 am #19545
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 -PassThruedit: removed pre tags since they seemed to not format correctly.
-
October 9, 2014 at 6:44 am #19548
@raymond This worked! Thanks!
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 -PassThruedit: removed pre tags since they seemed to not format correctly.
-
-
October 9, 2014 at 6:29 am #19546
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 : -
AuthorPosts
The topic ‘Set Computer Description on WMI’ is closed to new replies.