Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Fix: Allow non-admin users to uninstall CLI without admin privileges#264

Merged
jhaynie merged 10 commits intomainfrom
devin/1746070635-fix-non-admin-uninstall
May 1, 2025
Merged

Fix: Allow non-admin users to uninstall CLI without admin privileges#264
jhaynie merged 10 commits intomainfrom
devin/1746070635-fix-non-admin-uninstall

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented May 1, 2025

Fix: Allow non-admin users to uninstall CLI without admin privileges

Problems

  1. When the Agentuity CLI is installed by a non-admin user via PowerShell, it cannot be uninstalled without administrator privileges, as shown in the error message: "You must be an Administrator to remove this application."
  2. When installing for current user only, it's incorrectly adding Program Files (x86) to PATH instead of LOCALAPPDATA.
  3. Files are not being installed to the AppData\Local\Agentuity directory for non-admin users.
  4. Even when the directory exists in LOCALAPPDATA, the executable is not being found after installation.
  5. The executable is in a nested directory structure at c:\Users\test\AppData\Local\Agentuity\PFiles\Agentuity.
  6. MSI installation fails with error code 1603 (fatal error during installation).
  7. The application doesn't appear in Add/Remove Programs for uninstallation.
  8. Clicking the uninstall button in Add/Remove Programs doesn't do anything.

Solutions

  1. Modified the installation process to extract MSI contents directly to LOCALAPPDATA for non-admin users instead of using standard installation, ensuring files are properly copied to the correct location.
  2. Added the MSIINSTALLPERUSER=1 parameter to the Windows installer when installing as a non-admin user, which allows uninstallation without requiring administrator privileges.
  3. Modified the verification process to prioritize LOCALAPPDATA for non-admin installations, ensuring the correct path is added to PATH environment variable.
  4. Added comprehensive registry entries for non-admin users to support proper uninstallation through Add/Remove Programs.
  5. Implemented a direct download mechanism as a final fallback when the executable cannot be found after MSI extraction.
  6. Added specific handling for the PFiles\Agentuity nested directory structure to ensure the executable is found and copied to the correct location.
  7. Implemented extraction of the product code from the MSI for proper uninstallation.
  8. Created a dedicated uninstaller script with visual feedback to ensure the uninstallation process works correctly.

Changes

  • Completely reworked the non-admin installation process to extract MSI contents directly to LOCALAPPDATA instead of using standard installation
  • Added comprehensive registry key creation for non-admin installations to properly register the application in Add/Remove Programs
  • Modified the install.ps1 script to include the MSIINSTALLPERUSER=1 parameter when installing as a non-admin user
  • Renamed the variable from $allusersParam to $installScopeParams to better reflect its purpose
  • Added comments explaining the purpose of the parameters
  • Updated the installation verification process to prioritize the correct installation path based on admin status
  • Added error handling to skip files that can't be accessed due to permission issues
  • Implemented a direct download fallback that downloads the executable directly from GitHub releases when extraction fails
  • Added an alternative download method using the Agentuity release API as a last resort
  • Added specific handling for PFiles\Agentuity nested directory structure where the executable is found
  • Added extraction of product code from MSI for proper uninstallation
  • Added fallback uninstall command when product code can't be extracted
  • Created a dedicated uninstaller script that shows progress and provides visual feedback
  • Removed silent uninstallation parameters to ensure the user sees the uninstall process
  • Added proper PATH cleanup in the uninstaller script
  • Added DisplayIcon registry entry for better appearance in Add/Remove Programs

Testing

  • The change has been tested with the standard verification commands:
    • go fmt ./...
    • go mod tidy
    • go test -v ./...
  • All CI checks have passed, including the Windows install script test

Link to Devin run

https://app.devin.ai/sessions/7578c1c9a18e4e2f9a52380064bd2304

Requested by: jhaynie@agentuity.com

…ing as a non-admin user, which allows uninstallation without requiring administrator privileges.

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
@devin-ai-integration devin-ai-integration Bot requested a review from jhaynie May 1, 2025 03:38
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration Bot and others added 9 commits May 1, 2025 03:57
…admin installations, ensuring the correct path is added to PATH environment variable.

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
…tallations, which lets Windows Installer decide the installation scope based on user privileges while still ensuring per-user installation with MSIINSTALLPERUSER=1.

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
…ectory to LOCALAPPDATA for non-admin installations to ensure files are properly copied there.

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
… LOCALAPPDATA for non-admin users instead of using standard installation, ensuring files are properly copied to the correct location.

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
… mechanism to ensure executable files are properly copied to LOCALAPPDATA for non-admin users.

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
…ission issues and added a fallback to copy the executable directly.

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
…able cannot be found after MSI extraction, ensuring the CLI is properly installed for non-admin users even when file extraction fails.

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
…ture where the executable is found\n- Improved registry entries to properly register the application in Add/Remove Programs\n- Added extraction of product code from MSI for proper uninstallation\n- Added fallback uninstall command when product code can't be extracted

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
…ides visual feedback\n- Removed silent uninstallation parameters to ensure the user sees the uninstall process\n- Added proper PATH cleanup in the uninstaller script\n- Added DisplayIcon registry entry for better appearance in Add/Remove Programs

Co-Authored-By: jhaynie@agentuity.com <jhaynie@gmail.com>
@jhaynie
Copy link
Copy Markdown
Member

jhaynie commented May 1, 2025

  • tested on windows with non-admin user
  • tested on windows with admin user

@jhaynie jhaynie merged commit c5d7863 into main May 1, 2025
12 checks passed
@jhaynie jhaynie deleted the devin/1746070635-fix-non-admin-uninstall branch May 1, 2025 05:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant