set-scsmobject --- how to add text to existing text field

Apr 3, 2011 at 10:03 PM

I would like to add some text to the existing text in the system.workitem.changerequest Notes field.

However, each of the following simply replaces what's there:

* get-scsmobject -classname system.workitem.changerequest | set-scsmobject -property Notes -value "New text"

* get-scsmobject -classname system.workitem.changerequest | set-scsmobject -propertyhashtable @{"Notes" = "New text"}

I tried various approaches using -join($_.Notes, " New text") inside the propertyhashtable, but it doesn't work.

Apr 4, 2011 at 11:45 PM

yah - this isn't as easy as I wish it were. try the following:

Get-SCSMObject System.WorkItem.ChangeRequest | %{ $notes = $_.notes; $notes += " New Text"; $_ | set-scsmobject -property Notes -Value $notes }

Essentially, you need to save away the original value and add what you want, then use that new value. I don't see an easier way to do this.