Repository navigation
PowerShell 7 is now the primary edition; Windows PowerShell 5.1 is still supported and tested.
This release has breaking changes. Read them before upgrading.
Breaking changes
- PowerShell 5.1 or later is required (was 3.0). On WMF 4/5.0, stay on 0.4.16 or upgrade WMF.
- The module always targets the server's current API version.
Connect-CWM -Versionis removed. Connect-CWM
reads the version from/system/info, and every request pins the Accept header to it (0.4.16 sent no version
unless you passed-Version). Response models now match the server's current API. If a script reads a field
that older API versions returned, check it against the current model.
Migration: remove-Versionfrom yourConnect-CWMcalls. - New-CWMTicket no longer has
-Version,-VersionAutomatic,-project,-phase,-wbsCode,-locationId,
-businessUnitId,-dateEnteredor-enteredBy.
Migration: create project tickets with the newNew-CWMProjectTicket(#43). Drop the other parameters; the
API sets or ignores them. - Removed parameters that the API does not accept (they were ignored or rejected by the server):
New-CWMProductCatalog -dateEntered;New-CWMMember -TimeZoneSetupReference,-remotePackage,-remotePackagePlatform,-remotePackageUserName,
-remotePackagePasswordand-remotePackageAccount;-idonGet-CWMTicketAllNote(the all-notes endpoint has no single-note route).
- Positional binding shifted because of the removals and new route ids. If you pass these by position, switch to
named parameters:Get-CWMTicketAllNote:-conditionand the parameters after it moved up one position (no-id).New-CWMMember: the parameters after-timeZonemoved up one, and the ones after
-agreementInvoicingDisplayOptionsmoved up six.New-CWMProductCatalog: the parameters after-integrationXRefmoved up one.Get-CWMProductAdjustmentDetail: the new mandatory-parentIdis position 0, so-idis now position 1.New-CWMProjectTicketConfiguration:-_infomoved from position 2 to 3 (new-deviceIdentifier).
- Wrong aliases removed or replaced:
Remove-CWMDocument:-somethingIdis now-documentId;Update-CWMProductAdjustment:-catalogIdis now-adjustmentId;Update-CWMPurchaseOrder:-catalogIdis now-purchaseOrderId;Get-CWMCompanyCountry: the misleading-companyIdalias is removed.
- Route ids are now mandatory where a missing id built a broken URL:
Get-CWMCompanyTeam -parentId,
Get-CWMProductAdjustmentDetail -parentId,New-/Update-/Remove-CWMProductPickingShippingDetail -parentId,
New-CWMMarketingGroupCompany -parentId(alias-groupId),New-CWMMemberToken -memberIdentifier,
New-CWMOpportunityForecastItem -id(it defaulted to 0, which posted to/forecast/0), and the ticket ids of
New-CWMTicketChild. - Parameter types now match the API:
New-CWMProductCatalog -priceAttributetakesFixedFee,NotToExceed,OverrideRateorTimeAndMaterials
(it was an[int], which the API rejects);New-CWMTicketConfigurationandNew-CWMProjectTicketConfiguration:-idis an[int], and
-deviceIdentifieris its own parameter, sent asdeviceIdentifier(it was an alias of-id);Get-CWMSSOConfiguration -idis an[int], as in the API;New-CWMCompanyContact -countryis a reference such as@{ id = 1 }; a country name string no longer binds.
Connect-CWM -MemberIDnow really impersonates the member. 0.4.16 silently connected with the API key
instead. Check what the impersonated member is allowed to do before relying on it.- An
addorreplaceupdate without a value now errors instead of silently sendingnull. Pass
-Value $nullexplicitly to clear a field.New-CWMTicketChildalso errors when-OperationTypedoes not match
the parameters (a merge without-StatusIDused to send status 0). New-CWMDocumentuploads are private by default. ThePrivateFlagpart header was malformed (missing
closing quote), so the server most likely ignored it and applied its own default. Now-Private(default$true)
reaches the server. Migration: pass-Private $falsefor documents that customers should see.
Added
-PatchOperationson everyUpdate-CWM*function, to change several fields in one PATCH request (#53). The
existing-Operation/-Path/-Valueform still works, and-Valueis optional forremove.Connect-CWM -AllowInsecureRedirect: opt-in workaround for the PowerShell 7.4+ error "Cannot follow an
insecure redirection" on create and update calls against ConnectWise-hosted servers (#56, #70, #81, PR #58).
Redirects are never followed, so nothing is sent over http. No effect on 5.1 or 7.0-7.3.- Knowledge base:
Get-,New-,Update-andRemove-CWMKnowledgeBaseArticle(#59). - Project tickets:
New-CWMProjectTicket(posts to/project/tickets, so the ticket lands on the project) (#43)
andGet-CWMProjectTicketAllNote. - Company service templates (from PR #82):
Get-,New-,Set-,Update-,Remove-and
Copy-CWMCompanyServiceTemplate,Add-andRemove-CWMCompanyServiceTemplateLink, and
Invoke-CWMCompanyServiceTemplateGenerate. - Service templates:
Get-CWMServiceTemplate, andGet-,New-,Set-andUpdate-CWMServiceTemplateResource. - Tickets:
Remove-CWMTicketChildunbundles child tickets through/detachChildren(#34). - Other getters:
Get-CWMInvoiceandGet-CWMOpportunityNote. - Master functions:
Invoke-CWMSetMaster(PUT) andInvoke-CWMActionMaster(bodyless POST actions), for
endpoints that have no wrapper yet. New-CWMProjectTicketaccepts-workRole,-workType,-locationand-department.- Examples:
Set-CWMConfigurationLastUser.ps1(#79),Get-TicketsForConfiguration.ps1(#38), and an optional lunch
window inTimeSucks.ps1. - Comment-based help for every public function (
Get-Help <function> -Full), and regeneratedDocs/. Get-CWMDocument -download -OutFilesaves a document to disk. Without-OutFilethe content is returned as
abyte[].- User-Agent
ConnectWiseManageAPI/<version> PowerShell/<version>on every request, so ConnectWise can identify
the module's traffic. - 29 new endpoint functions (checked against the 2026.11 OpenAPI spec):
- Custom fields:
Get-,New-,Update-andRemove-CWMUserDefinedField(/system/userDefinedFields). - Agreements:
Get-,New-,Update-andRemove-CWMAgreementAdjustment,-CWMAgreementWorkRoleand
-CWMAgreementWorkType(/finance/agreements/{id}/adjustments,/workroles,/worktypes). - Invoices:
New-CWMInvoice,Update-CWMInvoice, andGet-CWMInvoice -id <n> -pdf [-OutFile]for the invoice PDF. - Ticket children:
Get-CWMTicketTimeEntry,Get-CWMTicketScheduleEntry,Get-CWMTicketDocumentand
Get-CWMTicketProduct. They return full records from/time/entries,/schedule/entries,/system/documents
and/procurement/products, not the id-only/service/tickets/{id}/...endpoints the API documentation
redirects from. - Lookups:
Get-CWMWorkRole,Get-CWMWorkType,Get-CWMExpenseType,Get-CWMConfigurationStatusand
Get-CWMWorkflow. - Expenses:
Update-CWMExpenseEntryandRemove-CWMExpenseEntry.
- Custom fields:
Changed
-allasks for 1000 records per page (the API maximum; was 999) and keeps a smaller-pageSizeif you
pass one. Paging follows therel="next"entry of theLinkheader instead of the first link.[datetime]values in request bodies and patch values are sent as ISO 8601 UTC (2026-01-02T03:04:05Z) on
both editions. Windows PowerShell 5.1 sent\/Date(ms)\/; PowerShell 7 sent local dates with their offset and dates
without a kind with no offset. Local dates (for exampleGet-Date) are converted to UTC. Dates without a kind (for
example[datetime]'2026-01-02') are sent unchanged as UTC, as PowerShell 7 sent them, so a calendar date keeps its
day. String parameters are sent as given.- Retry policy. Reads (GET/HEAD) and searches retry on 502, 503 and 504; every method retries on 429. Writes
(POST/PATCH/PUT/DELETE) are never retried on a 5xx, so a retry can't create a duplicate. The wait honours
Retry-After, otherwise it backs off 2, 4, 8, 16 and 32 seconds (about 62 seconds in total over 5 retries).
(0.4.16's retry loop never actually ran.) - Error messages include the ConnectWise error code and message, field-level validation errors, and the HTTP
status. The wording of earlier versions is kept, but the error id suffix is now,Write-CWMWebRequestError
(was,Invoke-CWMWebRequest). Update scripts that match onFullyQualifiedErrorId. Redirect errors say
whether the record may already have been created (#70). - Connect-CWM reconnects on its own when the server, company, sign-in method or member differs from the current
connection;-Forceis only needed to refresh the same connection. A failed connect leaves no partial state:
a failed-Forcereconnect as the same identity keeps the previous, unexpired connection, and any other failed
connect clears it. Connect-CWM -Serveraccepts a pasted URL (reduced to the host),host:portand hostnames with underscores.
Hosts that contain user info,?,#or\are rejected.- Redaction: password, token, private key, secret and memberHash values are masked in debug, verbose and
-WhatIfoutput.New-CWMDebugReportomits headers, the session and errors. - Some request fields use their API schema names; the old names still work as aliases:
billSeparateFlag,
mobileGuid,_info,New-CWMCompanyTeam -location/-department, and
New-CWMCompanyContact -managerContact/-assistantContact. Disconnect-CWMalso clears the cookie session, and does nothing quietly when you are not connected.Submit-CWMTimeSheetcallsUpdate-CWMTimeSheet -Submitand supports-WhatIf.Tests/Invoke-Tests.ps1writes its results toTestResults/(one file pair per PowerShell version, overwritten
each run) instead of timestamped files in the repo root.- Live tests (opt-in, never in CI):
Tests/Live.Read.Tests.ps1is read-only and safe on production; it calls
everyGet-*function and checks conditions, ordering, fields, counts and paging.Tests/Live.Write.Tests.ps1
creates, changes and deletesPSTESTrecords on a sandbox server and also needs$env:CWMAllowWrite = 'yes'.
Run them with./Tests/Invoke-Tests.ps1 -Test -Live, using settings in the gitignoredTests/live.local.ps1
(copyTests/live.example.ps1).Tools/Remove-CWMTestData.ps1finds and removes records left by an interrupted
run. These replaceTests/ConnectWiseManageAPI.Tests.ps1. - New offline tests:
Tests/Conventions.Tests.ps1(approved verbs, complete help, ShouldProcess on writes, Get
parameters the masters read, manifest aliases) andTests/GetSmoke.Tests.ps1(everyGet-*sends one
well-formed request).Invoke-Tests.ps1also counts failed blocks and files as failures. Tools/Update-CWMManifestExport.ps1also keepsAliasesToExportin sync with the[Alias()]attributes.- CI runs on
integration/**branches, cancels superseded runs, has a job timeout and uses actions v7.
Dependabot keeps the actions current, and a weekly workflow checks every endpoint against a pinned, reviewed
copy of a community-maintained ConnectWise OpenAPI spec
(covenanttechnologysolutions/connectwise-rest).
Fixed
Get-CWMDocument -downloadreturns the file. It used to parse the file as JSON and fail.Connect-CWMuses the server's codebase for the impersonation token and cookie login requests (they were
hard-coded tov4_6_release, which broke on-premises servers with another codebase), and sends theClientID
header to/login/companyinfo.- A response that is not JSON no longer comes back as a result object from
Get-*functions; only the error is
written. - Nine functions that were never exported (their files had plural names) can now be called:
Get-,New-andUpdate-CWMAgreementType,Get-,New-,Update-andRemove-CWMProductPickingShippingDetail,
Get-CWMOpportunityStageandGet-CWMOpportunityStatus. - Windows PowerShell 5.1 sends request bodies as UTF-8, so non-Latin-1 text is no longer mangled (#78; diagnosis by
AndreasMoe). Update-CWM*with a PSCustomObject-Value(for example$ticket.board) sends the object instead of{}.-allon 5.1 returns a flat list instead of nested per-page arrays.-countworks onGet-CWMAuditTrailandGet-CWMDocument.- URL bugs:
Update-/Remove-CWMProductPickingShippingDetailsent a literal{parentId};
Get-CWMProductAdjustmentDetailalways called//details;New-CWMMarketingGroupCompanysent the group id in
the body;New-CWMAgreementTypeposted to the wrong path; path casing onwarehouseBins,inventoryOnHand,
holidayLists,myMembers,mySecurityandallNotes. Get-CWMReportColumnno longer fails on an uninitialized result (#65).New-CWMTicketChildbundles and merges correctly; the nested status is serialized (#34).New-CWMDocumentuploads are byte-exact (they were corrupted on PowerShell 7.4+).Update-CWMTimeSheetno longer sends its action switches in the request body.Get-CWMContactTypeapplies its filter, andNew-CWMCompanyContact -portalPasswordworks.Invoke-CWMGetMasterandInvoke-CWMSearchMasterno longer pick up$id/$URLParametersfrom the caller's
scope, and the masters no longer return a stale$Resultunder-WhatIf.- Clearer help for
New-/Update-CWMCompanyConfigurationTypeQuestionValue: they edit a question's allowed values,
not a configuration's answer (#45). TimeSucks.ps1example: the scheduled task duration no longer drops minutes (#23).- Money and quantity values keep their precision. Decimal parameters were single-precision
[float](and
New-CWMOpportunity -totalSalesTaxan[int]), so 1234567.89 was sent as 1234567.9. They are[double]now. - Parameters the API takes as arrays accept arrays:
-customFields,New-CWMProductAdjustment -adjustmentDetails,
-serialNumberIds,-serialNumbersandNew-CWMTicket -integratorTags.New-CWMMemberacceptsEmail,TELand
CALLTO;New-CWMTimeEntry -chargeToTypeacceptsCompany. New-CWMCompanyConfiguration -backupBillableSpaceGbkeeps its decimals.Get-CWMOpportunity,
Get-CWMOpportunityStatusandGet-CWMOpportunityStagetake-idand-count.New-CWMCompanyNoteno longer sends the company id in the request body. Its route id is-parentId;
-companyIdand-idstill work.Get-CWMReportescapes the report name;Get-CWMOpportunity*send an array-fieldscorrectly.ConvertTo-CWMTimeuses the invariant culture (other cultures could produce dates the API rejects).Connect-CWMconnects again when-ClientIDor-BasePathchanges, instead of keeping the old values.New-CWMDocument -FilePathresolves relative paths against the current PowerShell location.New-CWMAgreementType -Confirmprompts once.New-CWMDebugReporthashes with SHA-256 (MD5 fails under FIPS).
Security
-allpaging only follows next-page links on the connected host and port, with no https-to-http downgrade, so
credentials are never sent to another host. A link that fails the check stops the call with a terminating
error rather than returning a partial result.Connect-CWMvalidates-Serverand escapes-Companyand-MemberID; cookie sessions use Secure cookies and a
stale cookie session is reset.- Secrets are masked in debug, verbose and
-WhatIfoutput, and kept out ofNew-CWMDebugReport. -AllowInsecureRedirectnever follows a redirect (-MaximumRedirection 0).New-CWMDocumentsanitizes multipart header values; string values in URL paths are escaped.
Contributors
Thanks to mdewart-Centre (PR #82), jadamwilson (PR #77), epiphanyplx (PR #79), damiankw (fixes inspired by PRs #71
and #76) and AndreasMoe (diagnosis of #78).