Skip to content

Add Project Ticket #43

Description

@JB0710

Trying to add a project ticket via PowerShell, when I use the -project with New-CWMTicket I get "New-CWMTicket : Cannot process argument transformation on parameter 'project'. Cannot convert the "386" value of type "System.Int32" to type "System.Collections.Hashtable".

Any assistance would be greatly appreciated!

Here is my code:

$CWMConnectionInfo = @{
   Server      = 'na.myconnectwise.net'
   Company     = 'BLANK'
   pubkey      = 'BLANK'
   privatekey  = 'BLANK'
   clientid    = 'BLANK'
}

# Install/Update/Load the module
if(Get-InstalledModule 'ConnectWiseManageAPI' -ErrorAction SilentlyContinue){ Update-Module 'ConnectWiseManageAPI' -Verbose }
else{ Install-Module 'ConnectWiseManageAPI' -Verbose }
Import-Module 'ConnectWiseManageAPI'

# Connect to your Manage server
Connect-CWM @CWMConnectionInfo -Force -Verbose

# Choose a company to make test a ticket for
#$Companies = Get-CWMCompany -all
#$Company = $Companies | Select-Object ID, Name | Out-GridView -OutputMode Single -Title 'Select Company'
$Company = '457'
$Project = '386'

$NewTicketParameters = @{
    summary = 'Install N-Central Agent on FWGLEX31LPTP'
    # We want to pass Manage objects as hash tables
    company           =    @{"identifier" = "$Company"}
    contactName = 'BLANK'
    contactPhoneNumber = 'BLANK'
    contactEmailAddress = 'BLANK'
   
}

$NewTicket = New-CWMTicket @NewTicketParameters -project $Project

# To clear your connection information from memory you can terminate the session or issue the disconnect command.
Disconnect-CWM

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions