What values can be stated in the CONTENT hash?

RT v4.2.8
Powershell v4.0

Newbie alert !!

I’m trying to automate the creation and updating of tickets using Powershell. I can create and comment on tickets, modify CC lists etc but I’m having a lot of trouble trying to add an attachment to an existing ticket without having to send an email to the system/ticket. I think there may be some limitation in what the contents of the content hash in the posted parameters but can find little or no documentation on this.


$number = “12345”;
$now = Get-Date -Format G

$body = @"


"@ $contype='text/html'

$server = “https://myserver.mydomain.com/REST/1.0/ticket/$number/comment?user=” + $user + “&pass=” + $pass
$att = “C:\batchfiles\powershell\testlog.log”

$post_params = @{
id: $number
Content-Type: $contype
Text: $body
Action: comment

$response = Invoke-WebRequest -Uri $server -Method Post -Body $post_params

The code above adds a comment to the ticket but doesn’t add the attachment.

I have tried moving the ‘Attachment’ out of the contents (as implied in a post on the web) leaving the ‘attachment_1’ inside it and all other combinations. This is the last stumbling block before I can start coding the project so any help would be appreciated.