Skip to content

CUT-5158 - Remote Revert in EXE#258

Merged
jworkmanjc merged 7 commits into
v2.13.0from
CUT-5158_RemoteRevert
May 21, 2026
Merged

CUT-5158 - Remote Revert in EXE#258
jworkmanjc merged 7 commits into
v2.13.0from
CUT-5158_RemoteRevert

Conversation

@jworkmanjc
Copy link
Copy Markdown
Contributor

@jworkmanjc jworkmanjc commented May 19, 2026

Issues

  • CUT-5158 - Add remote revert options to the generated exe

What does this solve?

Adds the option to remotely revert an account with the generated EXE, useful for remote scenarios where you may not want to remote into the machine to perform a GUI reversion.

New parameter sets added to the generated EXE to perform account reversion.

This does not change the existing behavior for the the EXE parameters, in other words when you migrate using the existing parameters, the "start-migration" parameter path is now default. No changes required to any of the remote migration scripts required, this is backwards compatible with existing scripts.

Is there anything particularly tricky?

NO

How should this be tested?

Screenshots

Screenshot 2026-05-19 at 11 16 02 AM

Note

Medium Risk
Medium risk because it changes the generated EXE’s CLI entrypoint/parameter parsing and invokes Start-Reversion, which performs registry and profile-file operations that can impact user logon state if misused.

Overview
Adds remote reversion support to the generated EXE. New-ADMUTemplate.ps1 now emits a CmdletBinding(DefaultParameterSetName='Migrate') param block with a new Revert parameter set (UserSID, optional TargetProfileImagePath, DryRun, Force) and an execution branch that runs Start-Reversion non-interactively and returns exit code 1 on failure.

Improves reversion UX/robustness by updating Start-Reversion help text and deferring profile-size calculation until after the profile path is resolved (with safe fallbacks), ensuring progress updates include the resolved path/size.

Separately, JumpCloud API error messages in Get-MtpOrganization and Test-JumpCloudUsername now include the effective global:JCUrl, and Start-Migration avoids calling Test-JumpCloudUsername during GUI init unless AutoBindJCUser is enabled and an API key is provided. Release metadata/docs and the EXE build script are updated accordingly (template import path + changelog/manifest dates).

Reviewed by Cursor Bugbot for commit 65dade4. Bugbot is set up for automated code reviews on this repo. Configure here.

@jworkmanjc jworkmanjc added ADMU ADMU Module Release minor Minor Version Release labels May 19, 2026
@jworkmanjc jworkmanjc marked this pull request as ready for review May 19, 2026 17:30
@jworkmanjc jworkmanjc requested a review from a team as a code owner May 19, 2026 17:30
@jworkmanjc jworkmanjc requested a review from shashisinghjc May 19, 2026 17:30
Comment thread Deploy/Functions/New-ADMUTemplate.ps1
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reformatted this file to use all single quote type here strings, escaping variable strings was cumbersome and added to the complexity of the template file for the EXE. What to look for here are changes to the parameter set, everything else should be the same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added additional messaging to the throw message here to help me diagnose a bug resolved in start-migration

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added additional messaging to the throw message here to help me diagnose a bug resolved in start-migration


# Validate JumpCloudSystemUserName to write to the GUI
$ret, $script:JumpCloudUserId, $JumpCloudSystemUserName = Test-JumpCloudUsername -JumpCloudApiKey $JumpCloudAPIKey -JumpCloudOrgID $JumpCloudOrgID -Username $JumpCloudUserName
if ($AutoBindJCUser -and (-not [string]::IsNullOrEmpty($JumpCloudAPIKey))) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously this was an edge case bug which would error if using the GUI without an API key and the new changes to EU/IN regions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only need to test for this username if we are using autoBindJCUser parameter and when the APIKey is present

}

$profileSize = Get-ProfileSize -ProfilePath $TargetProfileImagePath
# Profile size is calculated in process after the profile path is resolved from the registry.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick bug fix to address getting the targetProfileImagePath before it's set. It didn't break migration but left an error in logs which didn't make sense

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 65dade4. Configure here.

if (-not $revertResult.Success) {
Write-ToLog -Message "JumpCloud ADMU was unable to revert UserSID: $UserSID. Errors: $($revertResult.Errors -join '; ')" -Level Error
exit 1
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unhandled throw from Start-Reversion crashes EXE revert path

Medium Severity

The EXE template's revert path calls Start-Reversion @revertParams and then checks $revertResult.Success, but Start-Reversion can throw a terminating error from its begin block (e.g., when the user profile is currently loaded). In that case, $revertResult is never assigned, the friendly Write-ToLog error message and exit 1 never execute, and the script terminates with a raw unhandled exception instead of clean error output.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 65dade4. Configure here.

@gweinjc gweinjc self-requested a review May 19, 2026 19:34
Copy link
Copy Markdown
Contributor

@gweinjc gweinjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@jworkmanjc jworkmanjc merged commit 355ef38 into v2.13.0 May 21, 2026
13 checks passed
@jworkmanjc jworkmanjc deleted the CUT-5158_RemoteRevert branch May 21, 2026 16:04
jworkmanjc added a commit that referenced this pull request May 28, 2026
* CUT-5145 Device Query Updates (#255)

* default query mode

* profileSize/ lastWrite changes + tests

* v2.13.0

* MTP Tests

* define MTP as separate secret

* update test description

* device query tests

* Revert "device query tests"

This reverts commit 32286ac.

* update device query tests

* device query tests

* changelog

* ignore deviceQueryFunctions generated in tests

* set default state

* revert to previous test for CI null description systems

* missing test variable assignment + resolving skip behavior

* address issue for single users

* V2.13.0 <- V2.12.3 (#256)

* CUT-5052 V3 StatusReporting (#247)

* invoke

* char

* tests first pass

* update tests

* update

* date

---------

Co-authored-by: Joe Workman <joe.workman@jumpcloud.com>

* PSScriptAnalyzer Fix

* Update PSScriptAnalyzerSettings.psd1

* skip for now

* PSUseOutputTypeCorrectly

* Do not analyze test directory for now

* exclude state changing functions rule

* AvoidUsingEmptyCatchBlock

* PSUseOutputTypeCorrectly

* PSAvoidUsingWMICmdlet

* PSAvoidAssignmentToAutomaticVariable

* PSAvoidUsingWMICmdlet

* PSAvoidUsingWMICmdlet

* PSUseOutputTypeCorrectly

* PSUseProcessBlockForPipelineCommand

* PSAvoidAssignmentToAutomaticVariable

* PSReviewUnusedParameter false positive

* PSUseOutputTypeCorrectly

* PSAvoidUsingWMICmdlet

* change to Invoke-CimMethod

* Update PSScriptAnalyzerSettings.psd1

* Update Test-MigrationButton.Acceptance.Tests.ps1

* Get rid of homePath -it's not used

* changelog

* suppress PSScriptAnalyzer failure

* version

* Invoke-CimMethod to unjoin domain

* adding Pester and PSScriptAnalyzer to required

* Change output verbosity

* Update New-LocalUserProfile.ps1

set as string

* CUT-5119: ADMU Prd03 support

* Skip WindowsMDM from PSScriptAnalyzer

* Revert "Skip WindowsMDM from PSScriptAnalyzer"

This reverts commit 883c71f.

* Allow path exclusions PSScriptAnalyzer

* match support repo

* fix invoke

* Update ModuleChangelog.md

* fix dateTime parsing from updated CimInstance

* CUT-5119: check region by array

* fix: bugbot alerts

* show logged in (#253)

Co-authored-by: Joe Workman <54448601+jworkmanjc@users.noreply.github.com>

* Cut 5083 admu exe upload to jc commands option (#249)

* Initial hanges pushed - Added SHA validation and localEXE options enabled

* changelog

* Build updated

* Copy uwp_jcadmu.exe to C:\windows if localexe = True

* Build updated

* $RetryDelaySeconds configured

* download url for uwp_jcadmu.exe set to static

* fixed "UWP exe copy skips update when destination already exists"

* The fallback for AllowUnvalidatedOnApiFailure now handles all network or API failures (not just rate limiting)

* cursor review fixes

* Configured IsValid to be determined by only valid hash match

* The UWP EXE validation now only requires a hash match for IsValid, not a version match

* changelog updated

* Changes made as per review comments.

* Fixed: Historical release date for v2.12.2 incorrectly changed

* Merge conflicts managed and Release date updated

---------

Co-authored-by: Joe Workman <54448601+jworkmanjc@users.noreply.github.com>

* test in IN region

* test in EU

* test in EU

* MTP tests

* explicitly test with orgID

* "| Remove-JCAssociation" bug for dynamic user groups

* Revert "explicitly test with orgID"

This reverts commit 309bf83.

* revert test lines

---------

Co-authored-by: Ken Maranion <97972790+kmaranionjc@users.noreply.github.com>
Co-authored-by: Geoffrey Wein <geoffrey.wein@jumpcloud.com>
Co-authored-by: Geoffrey Wein <89030113+gweinjc@users.noreply.github.com>
Co-authored-by: lucasmendes-jc <lucas.mendes@jumpcloud.com>
Co-authored-by: shashisinghjc <shashi.singh@jumpcloud.com>

* CUT-5158 - Remote Revert in EXE (#258)

* revert via gui_admu.exe

* resolve issue with test-jumpcloudusername halting migration without apikey

* resolve issue with profilepath parameter during revert

* formatting

* prep for release

* validate autobind + apikey

* hide pwsh window

* release date

---------

Co-authored-by: Ken Maranion <97972790+kmaranionjc@users.noreply.github.com>
Co-authored-by: Geoffrey Wein <geoffrey.wein@jumpcloud.com>
Co-authored-by: Geoffrey Wein <89030113+gweinjc@users.noreply.github.com>
Co-authored-by: lucasmendes-jc <lucas.mendes@jumpcloud.com>
Co-authored-by: shashisinghjc <shashi.singh@jumpcloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ADMU ADMU Module Release minor Minor Version Release

Development

Successfully merging this pull request may close these issues.

2 participants