Skip to content

PowerShell CMS Functions

CMS_* functions communicate with the CapaInstaller management server (custom/hardware inventory, group membership, package status, agent control, and more). They are standalone PowerShell functions — called directly, without the $cs. prefix used by the rest of the scripting library, e.g. CMS_AddCustomInventory -category '...' -entry '...' -value '...' -valuetype 'S'.

They ship in a separate module (CIScripting) that a PowerPack’s PSlib.psm1 imports automatically when present, so you don’t need to import anything yourself to use them from a PowerPack script.

Not every CMS_* function is available from PowerShell — some are VBScript-only, and a few are restricted to user packages. Each function’s page notes its PowerShell availability under Syntax.

CMS functions you can call from PowerShell

Section titled “CMS functions you can call from PowerShell”
Function What it does
CMS_AddComputerToCalendarGroup Adds the computer to the specified calendar group.
CMS_AddComputerToDepartmentGroup Adds a specified computer to the specified department group.
CMS_AddComputerToPowerSchemeGroup Adds the specified computer to the specified power scheme group.
CMS_AddComputerToReinstallGroup Adds the computer to the specified reinstall group.
CMS_AddComputerToStaticGroup Adds the computer to one or more static groups.
CMS_AddCustomInventory Adds a persistent CustomInventory row to the database, meaning that the data will not be flushed out the next time that the CustomInventory package is run.
CMS_AddHardwareInventory Adds a HardwareInventory row to the database that is persistent, meaning that the data will not be flushed out the next time that the HardwareInventory package is run.
CMS_AddPackageToUnit Adds the specified package to the unit on which the script is being executed.
CMS_AddUnitToBusinessUnit Adds the unit on which the script is executed to the specified Business Unit.
CMS_AddUnitToWSUSUnAssignedGroup Adds the unit to the unassigned WSUS group, letting the unit be linked to (another) apropriate dynamic WSUS group.
CMS_ExistPackageOnManagementServer Checks if the specified package exists on the management server the agent is connected to.
CMS_GetAdvertisedPackages Returns all packages advertised to the unit.
CMS_GetDeploymentTemplateVariable Returns a variable from the deployment template from which the client was installed.
CMS_GetGroupMembership The function returns which groups the current Unit is a member of.
CMS_GetInventory Gets inventory values from the database, from either the Hardware, Custom, or Logon inventory tables.
CMS_GetLinkedPackages The function returns which packages is linked to the current Unit.
CMS_GetPackage Returns the requested package.
CMS_GetPackageStatus Returns the status of the specified package for the unit.
CMS_GetProperty Returns a property from the property table in the SQL database.
CMS_InstallAdvertisedPackage Installs an advertised package.
CMS_IsPackageLinked Checks if a given package is linked to the unit.
CMS_IsPackageScheduleEnabled Checks if a given package has an active schedule.
CMS_RemoveComputerFromCalendarGroup Removes a specified computer unit from a calendar group.
CMS_RemoveComputerFromDepartmentGroup Removes a specified computer from a department group.
CMS_RemoveComputerFromPowerSchemeGroup Removes a specified computer from a power scheme group.
CMS_RemoveComputerFromReinstallGroup Removes the computer from a reinstall group.
CMS_RemoveComputerFromStaticGroup Removes a specified computer from a static group.
CMS_RemoveCustomInventory Removes a CustomInventory row that is persistent from the database.
CMS_RemoveHardwareInventory Removes a HardwareInventory row from the database that is persistent.
CMS_RemovePackageFromUnit Removes package from the unit.
CMS_RerunPackage Sets status for the specified package to ‘Waiting’ causing it to rerun the next time the Agent is being executed.
CMS_RunSystemAgent Reruns the CapaInstaller Service Agent.
CMS_RunUserAgent Creates a CallHomeUser unit command that makes the InfoCenter of the current user on the computer launch the agent script.
CMS_SetPackageStatusToInstalled Will set the status of a package to Installed.
CMS_UninstallPackageFromUnit Uninstalls package from unit.
CMS_UninstallPackageFromUnitById Uninstalls package from unit.

The full list, including the VBScript-only functions, is under CMS Functions.