Icinga for Windows fail due to Event Viewer error

Hello,

I have been getting an error when installing Icinga for Windows using the powershell script.
ExecutionPolicy has been set to unrestricted. My user is in the domain admins group.

PS C:\Users\shravan.dwarka> .\IcingaForWindows.ps1
[Notice]: PowerShell Execution-Policies are configured to run Scripts and/or Modules.
The following directories are available for installing PowerShell modules into:
[0]: C:\Users\shravan.dwarka\Documents\WindowsPowerShell\Modules
[1]: C:\Program Files\WindowsPowerShell\Modules (Recommended)
[2]: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
[3]: C:\Program Files (x86)\AWS Tools\PowerShell
Where do you want to install the Icinga PowerShell Framework into? ([0-3]) (Defaults: “1”):
[Notice]: Downloading Icinga PowerShell Framework into “C:\Users\SHRAVA~1.DWA\AppData\Local\Temp\icinga-powershell-framework-zip”
[Notice]: Installing Icinga PowerShell Framework into “C:\Program Files\WindowsPowerShell\Modules”
[Notice]: Installing new Icinga PowerShell Framework version
[Notice]: Unblocking Icinga PowerShell Framework files
[Notice]: Applying pending migrations required for Icinga for Windows v1.8.0
[Error]: Unable to load the Icinga PowerShell Framework. Please check your PowerShell execution policies for possible problems. Error: System.ComponentModel.Win32Exception (0x80004005): The handle is invalid
at System.Diagnostics.EventLogInternal.Clear()
at System.Diagnostics.EventLog.Delete(String logName, String machineName)
at Microsoft.PowerShell.Commands.RemoveEventLogCommand.BeginProcessing()
at System.Management.Automation.Cmdlet.DoBeginProcessing()
at System.Management.Automation.CommandProcessorBase.DoBegin()

I can see an entry has been created in Event Viewer, but nothing on the disk. I cannot delete nor clear any logs from that entry.

Things tried:

  1. Created the event file manually and gave required permissions on the file
  2. Allowed domain admins to manage audit logs etc

Nothing has given any positive feedback.

Any help would be much appreciated.

Shravan

Hello Shravan!

You could try the “Bypass” execution policy, it always works for me. At least for the current shell:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

Best,
A/K

1 Like

Hi @Al2Klimov ,

Thanks for the answer.

So I’ve resolved it by installing the icinga-powershell-framework from powershell gallery (Install-Module icinga-powershell-framework).

Then I launched the commands present in the documentation (available on IfW section).

However, on other Windows machine, it is working fine → No need to do all these steps. I just run the same commands and everything works like a gem.
P.S I included the ByPass thingy in the installation script, could be that it is helping :slight_smile:

Shravan