'Comment' AD Attribute for a computer

Hi All,

I'm having an issue adding text to the comment attribute in AD using powershell for a computer object.

I have used the follwoing (from MS technet article) to update the 'description' field but cannot use the same process for the 'comment' field.

"Import-Module ActiveDirectory
Import-CSV "D:\Dump\Scripts\CTest.csv" | ForEach-Object {
$Computer = $_.ComputerName
$Comm = $_.Comment
Set-ADComputer $Computer -comment $Comm }

obviously I changed the fields over from the MS example ($_.description & -description $desc)

even if I try and simply run the command  from powershell it doesn't work...

(WORKS)

set-adcomputer COMPUTERNAME -description DESCRIPTION_TEXT

(DOESN'T WORK)

set-adcomputer COMPUTERNAME -comment COMMENT_TEXT

Error = Set-ADComputer : A parameter cannot be found that matches parameter name 'comment'.

BUT this will pull back the current comment - I inputted some test text through AD Users n Computers

Get-ADComputer COMPUTERNAME -properties comment

Any ideas would be greatly recieved - have 2000 to update and doing via CSV is going to be MUCH easier.

Cheers

January 27th, 2014 9:33am

Hi,

Set-ADComputer doesn't have a -Comment parameter. Take a look at using -Add instead:

http://technet.microsoft.com/en-us/library/ee617263.aspx

Free Windows Admin Tool Kit Click here and download it now
January 27th, 2014 9:45am

No Worries, just in case anyone else needs this

found answer myself

http://technet.microsoft.com/en-us/library/ee617263.aspx

Looks like the 'COMMENT' field is LDAP so have to change syntax.

Set-ADComputer COMPUTERNAME -replace @{comment='comment_text'}

you can use Add, Remove, Replace or clear as a command. Looks like a lot of the fields in AD especially for computers need to be done this way.

Cheers

January 27th, 2014 9:45am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics