Icinga / Icinga/icinga-powershell-framework

Uninstalling IfW with JEA with managed user "icinga" enabled throws error

Open
#614 1 comment 0 reactions 1 assignee View on GitHub

@LordHepipud is already working on this.

Since Apr 22, 2025.

Bug Help wanted
Dominant language
PowerShell
Stars
87
Forks
34
PR merge metrics
No merged PRs in 30d

Description

Expected Behavior

Uninstalling IfW with JEA enabled or uninstalling JEA through Management Console should go through smoothly. This applies to having managed user "icinga" enabled; installing a JEA profile without managed user is currently not possible in our environment.

Current Behavior

Either uninstalling IfW completely (by Management Console or "Uninstall-IcingaForWindows -Force") or just the JEA profile throws the following error:

[Notice]: Waiting for lock on path „C:\Users\icinga“ to be released before trying to remove it
[Error]: Failed to remove items from path „C:\Users\icinga“. Recurse is „True“, Force is „True“: „System.UnauthorizedAccessException: Access to the path ‚C:\Users\icinga\AppData\Local\Application Data‘ is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileSystemEnumerableIterator‚1.CommonInit()
at System.IO.FileSystemEnumerableIterator‚1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler‚1 resultHandler, Boolean checkHost)
at System.IO.DirectoryInfo.EnumerateDirectories()
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force, Boolean rootOfRemoval)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force, Boolean rootOfRemoval)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force, Boolean rootOfRemoval)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force, Boolean rootOfRemoval)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveItem(String path, Boolean recurse)“
[Warning]: This user is not managed by Icinga directly. Skipping permission update

Please note that the rest of the uninstallation is going through with no issues. JEA is deactivated and IfW is uninstalled, respectively. It's just the user folder "icinga" is left over after this.

Additionally, I noticed during testing (which involved a number of installations and uninstallations of JEA & IfW on the host) that in C:\Users, a new folder for an icinga user is created whenever I install JEA with managed user. This holds true between installations of IfW.

grafik

I can delete some of those folders, but not all, even when IfW is uninstalled. Seems like I need rights from a longer existing user. The last few digits change between folders that are to be deleted.

grafik

Steps to Reproduce (for bugs)

  1. Install IfW & enable JEA with managed user "icinga" in the Management Console
  2. Uninstall JEA with managed user "icinga" or IfW completely via Management Console, or uninstall IfW in a PowerShell with "Uninstall-IcingaForWindows -Force"

grafik

Context

Since the rest of the uninstallation is going through, this is not really an issue in our daily work. Just wanted to bring it to attention or get to know whether this is a general issue or has something to do with our configuration.

Your Environment

  • PowerShell Version used ($PSVersionTable.PSVersion):
    grafik

  • Operating System and version (Get-IcingaWindowsInformation Win32_OperatingSystem | Select-Object Version, BuildNumber, Caption):
    grafik

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.