Changing local computer descrition with CIM

Welcome Forums General PowerShell Q&A Changing local computer descrition with CIM

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
1 year, 4 months ago.

  • Author
    Posts
  • #75062

    Participant
    Points: 22
    Rank: Member

    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
    
  • #75071

    Participant
    Points: 0
    Rank: Member

    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

The topic ‘Changing local computer descrition with CIM’ is closed to new replies.