Ivanti Deployment Agent – Change Deployment Group

Moves a computer to a new deployment group using the ccacmd.exe utility on the endpoint.

Note 1: The Allow unregistration option MUST be enabled in the original deployment group.
Note 2: The Allow self-registration option MUST be enabled in the target deployment group.

This script requires Management Center 8.6 or higher.
See https://community.ivanti.com/docs/DOC-68222 for additional details.
Version 1.0.15
Created on 2018-06-12
Modified on 2018-06-13
Created by Landon Winburn
Downloads: 37

The Script Copy Script Copied to clipboard
$DeploymentGroup = $args[1]
$URL = $args[0]

If ((Test-Path "C:\Program Files\AppSense\Management Center\Communications Agent\CcaCmd.exe") -eq $false){
    "CCA not found"
    exit(1)
}

"Unregistering the computer from the Management Server"
$output = & 'C:\Program Files\AppSense\Management Center\Communications Agent\ccacmd.exe' /unregister

If (-not ($output -eq "The operation succeeded.")){
    "Error unregistering the computer from the Management Server"
    exit(1)
}

"Deleting the Communications Agent key"
Try{
    remove-item -path 'HKLM:\SOFTWARE\AppSense Technologies\Communications Agent' -Recurse -Force}
Catch{
    "Error removing the Coummications Agent key"
    exit(1)
}

"Starting the CCA"
Try{
    start-service -name 'AppSense Client Communications Agent'}
Catch{
    "Error starting the CCA"
    exit(1)
}

"Joining the $DeploymentGroup deployment group"
$output = & 'C:\Program Files\AppSense\Management Center\Communications Agent\ccacmd.exe' /URL $URL $DeploymentGroup

If (-not ($output -eq "The operation succeeded.")){
    "Error unregistering the computer from the Management Server"
    exit(1)
}

"Restarting the CCA"
Try{
    Stop-Service -name 'AppSense Client Communications Agent' -Force
    Start-Service -name 'AppSense Client Communications Agent'}
Catch{
    "Error Restarting the service."
}

"Done"