<< Click to Display Table of Contents >> DeleteComputers |
Deletes one or more computers from PDQ Inventory. Computers can be specified by name or ID. Use this command to automate cleanup of decommissioned systems or integrate with external asset management workflows.
PDQInventory DeleteComputers -Computers <computer1> [<computer2> ...] [-Force] [-StopOnError]
Parameter |
Required |
Description |
|---|---|---|
-Computers <computer> ... |
Yes |
One or more computers to delete, separated by spaces. Each value can be a computer name (e.g., WORKSTATION-01) or a computer ID prefixed with # (e.g., #12345). Both methods can be combined in the same call. |
-Force |
No |
Skips the [y/N] confirmation prompt and deletes computers immediately. Use this flag for automated scripts where no interactive input is available. |
-StopOnError |
No |
Stops processing and returns an error if any specified computer is not found. Without this flag, not-found computers are reported but remaining computers are still deleted. |
Exit Code |
Meaning |
|---|---|
0 |
Command completed successfully. All found computers were deleted. |
1 |
Command failed. A computer was not found and -StopOnError was specified, or an unexpected error occurred. |
2 |
User cancelled at the confirmation prompt. |
3 |
No computers were found to delete. |
Delete a single computer by name:
PDQInventory DeleteComputers -Computers WORKSTATION01
Delete multiple computers at once:
PDQInventory DeleteComputers -Computers WORKSTATION01 WORKSTATION02 SERVER01
Delete a computer by ID:
PDQInventory DeleteComputers -Computers #12345
Delete computers silently for use in an automated script:
PDQInventory DeleteComputers -Computers WORKSTATION01 WORKSTATION02 -Force
Delete computers and stop immediately if any are not found:
PDQInventory DeleteComputers -Computers WORKSTATION01 WORKSTATION02 -StopOnError
Check the exit code in a PowerShell script:
PDQInventory DeleteComputers -Computers WORKSTATION01 -Force
if ($LASTEXITCODE -eq 0) {
Write-Host "Computer deleted successfully."
} elseif ($LASTEXITCODE -eq 3) {
Write-Host "Computer not found."
} else {
Write-Warning "Delete failed with exit code $LASTEXITCODE"
}
NOTE: All deletions are recorded in the audit log, including the computer name and that the action was performed via the command line.
© 2026 PDQ.com Corporation. All rights reserved.
PDQ.com is a trademark of PDQ.com Corporation. All other product and company names are the property of their respective owners.
Help Version: 20.0.22.0