Features β’ Installation β’ Quick Start β’ Functions β’ Examples β’ Wiki β’ Contributing
- Features
- Installation
- Quick Start
- Usage Examples
- Upgrading to 0.5.0
- Troubleshooting
- Available Functions
- Requirements
- Security
- Contributing
- Tutorials & Blog Posts
- Support
- License
This module makes it easy to leverage PowerShell to automate tasks in ConnectWise Manage:
- 250+ Cmdlets covering all major API endpoints
- Automated Pagination for large result sets
- Advanced Filtering using ConnectWise condition syntax
- Retry Logic for throttling and transient errors (writes are retried only on 429, so a retry never creates a duplicate)
- Object Output that works with the PowerShell pipeline (Where-Object, Select-Object, Export-Csv)
- Built-in Help with examples for every function (
Get-Help <function> -Full) - Cross-Platform: PowerShell 7 on Windows, Linux and macOS, and Windows PowerShell 5.1
Install-Module 'ConnectWiseManageAPI' -Scope CurrentUserUpdate-Module 'ConnectWiseManageAPI'Note: If you're having issues accessing the PowerShell Gallery, check out this repair script
Important: As of August 14, 2019, ConnectWise requires a Client ID to interact with the API.
# Connect to ConnectWise Manage
Connect-CWM -Server 'na.myconnectwise.net' `
-Company 'YourCompany' `
-pubkey $publicKey `
-privatekey $privateKey `
-clientId $clientIdFor detailed authentication options and setup, see the Authentication Wiki.
# Get all open tickets
Get-CWMTicket -condition "status/name='Open'" -all
# Create a new ticket
$ticketParams = @{
summary = 'Issue reported via PowerShell'
board = @{ id = 1 }
company = @{ id = 123 }
status = @{ id = 456 }
}
New-CWMTicket @ticketParams
# Update one field of a ticket
Update-CWMTicket -id 12345 -Operation replace -Path status -Value @{ id = 789 }
# Update several fields in one request
Update-CWMTicket -id 12345 -PatchOperations @(
@{ op = 'replace'; path = 'status'; value = @{ id = 789 } }
@{ op = 'replace'; path = 'summary'; value = 'Updated from PowerShell' }
)# Search for companies by type (types is a list, so use -childConditions)
Get-CWMCompany -childConditions "types/name='Partner'" -all
# Get company with specific ID
Get-CWMCompany -id 123
# Create a new company (look up the type ID with Get-CWMCompanyType)
$companyParams = @{
identifier = 'ACME'
name = 'ACME Corporation'
types = @(@{ id = 1 })
}
New-CWMCompany @companyParams# Get time entries for a date range
Get-CWMTimeEntry -condition "timeStart > [2024-01-01] and timeStart < [2024-01-31]" -all
# Create a new time entry
$timeParams = @{
company = @{ id = 123 }
chargeToType = 'ServiceTicket'
chargeToId = 12345
timeStart = (Get-Date) | ConvertTo-CWMTime -Raw
timeEnd = (Get-Date).AddHours(2) | ConvertTo-CWMTime -Raw
member = @{ identifier = 'JDoe' }
}
New-CWMTimeEntry @timeParamsMore examples available in the Examples directory.
0.5.0 has breaking changes. The main ones:
- PowerShell 5.1 or later is required (was 3.0).
- The module always uses the server's current API version.
Connect-CWM -Versionis removed; remove it from your scripts. - New-CWMTicket no longer takes
-Version,-VersionAutomatic,-project,-phase,-wbsCode,-locationId,-businessUnitId,-dateEnteredor-enteredBy. Create project tickets withNew-CWMProjectTicket. Connect-CWM -MemberIDnow really impersonates the member (0.4.16 silently used the API key).- A few parameters and aliases the API did not accept were removed, some route ids are now mandatory, and positional binding shifted on five functions. Use named parameters.
See the CHANGELOG for the full list and migration hints.
On PowerShell 7.4 and later, create and update calls (New-CWM*, Update-CWM*) against some ConnectWise-hosted servers can fail with "Cannot follow an insecure redirection by default". The server's response carries an http:// Location header, usually on a request it has already processed, so the record may exist even though you saw an error.
Connect with the opt-in -AllowInsecureRedirect switch:
Connect-CWM -Server 'na.myconnectwise.net' -Company 'YourCompany' `
-pubkey $publicKey -privatekey $privateKey -clientId $clientId `
-AllowInsecureRedirectWith the switch, PowerShell accepts that response, but the module never follows a redirect on a create or update (nothing is sent over http). If the server sends a real redirect, you get an error saying it was not followed and that the record may already exist. The switch has no effect on Windows PowerShell 5.1 or PowerShell 7.0-7.3, which do not raise this error. Whenever you see either error, check whether the record was created before you retry.
The module includes 250+ cmdlets organized by functional area:
| Category | Functions |
|---|---|
| Service | Tickets, Service Boards, Ticket Notes, Configurations, Knowledge Base, Service Templates |
| Company | Companies, Contacts, Sites, Teams |
| Time | Time Entries, Time Sheets |
| Project | Projects, Phases, Team Members, Project Tickets |
| Finance | Agreements, Billing, Invoices |
| System | Members, Audit Trail, Documents |
| Sales | Opportunities, Activities |
| Marketing | Marketing Groups |
| Procurement | Products, Inventory, Purchase Orders |
| Schedule | Calendar Entries, Holidays |
For a complete list of available functions, see ConnectWiseManageAPI_Functions.md.
- PowerShell Version: PowerShell 5.1 or later. PowerShell 7.4+ is recommended (Windows, Linux and macOS); Windows PowerShell 5.1 is still supported. Both are tested on every change.
- ConnectWise Manage: Active instance with API access
- API Credentials: Public/Private API keys and Client ID
- Dependencies: None (self-contained module)
For reporting security vulnerabilities, please see our Security Policy.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated!
- Star this repository β - It helps others discover the project
- Report bugs - Use the bug report template
- Suggest features - Use the feature request template
- Submit pull requests - See our Contributing Guide
- Share your work - Show us what you've built!
Want to share something you created using the module? Submit it to be featured as a Community Package.
In-depth tutorials on christaylor.codes:
| Tutorial | Description |
|---|---|
| Introducing ConnectWiseManageAPI | Module overview, architecture, and key features |
| Getting Started | Authentication, setup, and first API calls |
| Advanced Automation | Complex workflows and real-world automation scenarios |
| Best Practices | Production deployment patterns and performance tips |
- π Check the Wiki for detailed documentation
- π Report bugs
- π‘ Request features
- π§ Browse existing issues
If this project has helped you, please consider:
- β Starring the repository
- π¦ Sharing it on social media
- π° Sponsoring the project
Your support enables continued development and maintenance of this project!
This project is licensed under the MIT License - see the LICENSE file for details.
- ConnectWise for providing the Manage API
- The MSPGeek community for feedback and support
- All contributors who have helped improve this module
Made with β€οΈ by Chris Taylor
