DevOp.DK.Plus is a PowerShell module for the DK Plus API. It gives you one cmdlet for every devop-dk command, so you can read and change DK Plus data from scripts, scheduled tasks, and an interactive shell without writing C#.
The module uses the same typed client as the .NET library and the devop-dk tool, so validation, retries, and safe error messages behave the same way.
| Guide | Use it for |
|---|---|
| Cmdlet reference | Naming, Get-Help, and one page per area with the cmdlet-to-CLI table |
| Pipelines and updates | Get- to Update- piping, sparse updates, hashtables, JSON files, and number and date rules |
| Safety and errors | -WhatIf, -Confirm, secrets, and error handling in scripts |
| Output and files | Default table views, Select-Object, ConvertTo-Json, and Save-* file cmdlets |
Check your version:
$PSVersionTable.PSVersion
Install the module from the PowerShell Gallery:
Install-Module DevOp.DK.Plus -Scope CurrentUser
Import-Module DevOp.DK.Plus
To update an installed module:
Update-Module DevOp.DK.Plus
Install-PSResource DevOp.DK.Plus and Update-PSResource DevOp.DK.Plus work too if you use PSResourceGet. The module is updated from the PowerShell Gallery; devop-dk update only updates the command-line tool.
The module needs a DK Plus API token. It never takes a token as plain text: a token is always a SecureString, read from an environment variable or file, or taken from the stored login.
If you already ran devop-dk login, you are done. The module and the CLI share the same stored login and the same non-secret configuration (base URL, language, page size, retries, and timeouts). On Windows the stored login is kept in the non-roaming %LOCALAPPDATA%\DevOp\devop-dk folder, readable only by the current user (a token stored by an earlier version in %APPDATA% is moved on first use; update the module and the CLI together, because a 0.4.2 CLI or module reads only the old copy). The first DK Plus cmdlet you run opens a connection from that login by itself:
Get-Company
You can also store the login from PowerShell. It is verified first and then shared with the CLI:
Save-Login
Save-Login asks for the token at a hidden prompt. To store a token from a secret vault, pass a SecureString:
Save-Login -Token (Get-Secret DkPlusToken)
Connect-DkPlus opens a connection for the current PowerShell session. It sends no request; use Test-DkPlusConnection to check the token.
Connect-DkPlus -Token (Read-Host -AsSecureString 'DK Plus API token')
Test-DkPlusConnection
Without -Token, the token comes from DKPLUS_API_TOKEN, then DKPLUS_API_TOKEN_FILE, then the stored login. Set DKPLUS_API_TOKEN_FILE to a file that holds the token for unattended jobs, and keep that file readable only by the account that runs the job.
To work with two companies in one script, keep the connections and pass them to the cmdlets:
$a = Connect-DkPlus -Token $tokenA -PassThru
$b = Connect-DkPlus -Token $tokenB -PassThru
Get-Customer -Number 10001 -Connection $a
Get-Customer -Number 10001 -Connection $b
The connection you opened last is the default. Connections belong to the PowerShell runspace that opened them, so ForEach-Object -Parallel and Start-ThreadJob need -Connection $using:conn.
Other session cmdlets:
| Cmdlet | What it does |
|---|---|
Get-DkPlusConnection |
Shows the default connection's host, base URL, language, and token source. It never shows the token. |
Disconnect-DkPlus |
Closes every connection, or the one you pass. |
Test-DkPlusConnection |
Verifies the credentials and the company connection with a read-only request. |
Remove-Login |
Deletes the stored login, for the CLI and the module. |
If the stored login or DKPLUS_API_TOKEN changes while a session is open, the automatic default connection notices on the next command and reopens itself. A connection you opened with Connect-DkPlus is never replaced silently. After you disconnect it, the next automatic connection writes a warning that names the token source and host, so a script cannot switch company unnoticed.
# Which company am I connected to, and is it ready?
Get-Company
Get-CompanyStatus
# List and look up customers
Get-Customer -Take 10
Get-Customer -Number 10001 | Format-List Number, Name, Email
# Products with a price calculation for a customer
Get-Product -Group 01 -Take 5
Get-ProductPrice P1 -Quantity 10 -Customer 10001
# A change, previewed first
Update-Customer 10001 -Email '[email protected]' -WhatIf
The list cmdlets return 100 records by default. -Take N changes that (1 to 1000), and -All returns every record after a confirmation (-Confirm:$false skips it in scripts); see Safety and errors.
Every cmdlet has built-in help:
Get-Command -Module DevOp.DK.Plus
Get-Help Update-Customer -Examples
| Piece | What it is | Install |
|---|---|---|
DevOp.DK.Plus PowerShell module |
Cmdlets for scripts and shells | Install-Module DevOp.DK.Plus |
devop-dk command-line tool |
The same operations as shell commands with --json output |
dotnet tool install --global DevOp.DK.Plus.Cli |
DevOp.DK.Plus NuGet package |
The typed .NET client for applications | dotnet add package DevOp.DK.Plus |
DevOp.ERP.Abstractions NuGet package |
Provider-neutral ERP contracts | dotnet add package DevOp.ERP.Abstractions |
The module is a separate delivery of the same client. It shares the login, configuration, request validation, and JSON document rules with the CLI, so a JSON file that works with devop-dk customer update --file works with Update-Customer -Path. It does not change the NuGet packages, and you do not need the .NET SDK or the CLI to use it. Cmdlet names differ from CLI command names; the cmdlet reference maps every CLI command to its cmdlet.
PowerShell objects are the DK Plus read models, for example DkPlusCustomer. They carry every field the client reads, including nested sections, so there is no --expand or --json switch: use Format-List, Select-Object, and ConvertTo-Json.