Author Posts

July 15, 2017 at 9:36 pm

The below snip changes a remote computer description. I was wondering if it would be better to use invoke-cimMethod, but I'm not sure how to figure out what methods I can use with the Win32_OperatingSystem to change the description value.

These are the methods I see with Get-Member
Clone
Dispose
Equals
GetCimSessionComputerName
GetCimSessionInstanceId
GetHashCode
GetObjectData
GetType
ToString

$OSValues = Get-CimInstance -ClassName win32_operatingsystem -ComputerName $ComputerName
$OSValues.Description = $ComputerDescription
Set-CimInstance -InputObject $OSValues

July 16, 2017 at 9:47 am

This is how you use Set-CimInstance to change the description

PS> Get-CimInstance -ClassName Win32_OperatingSystem | select Description

Description
-----------



PS> Get-CimInstance -ClassName Win32_OperatingSystem | Set-CimInstance -Property @{Description = 'Richards Laptop'}
PS> Get-CimInstance -ClassName Win32_OperatingSystem | select Description

Description
-----------
Richards Laptop

There isn't a method that does the job