Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register-IcingaEventLog causes exception on new systems #82

Closed
LordHepipud opened this issue Jul 28, 2020 · 0 comments
Closed

Register-IcingaEventLog causes exception on new systems #82

LordHepipud opened this issue Jul 28, 2020 · 0 comments
Assignees
Labels
Bug There is an issue present
Milestone

Comments

@LordHepipud
Copy link
Collaborator

Register-IcingaEventLog was introduced with Version 1.1.0 and allows us to write entries into the EventLog for debugging and general information. How ever, if being executed on the first time while run by a non-privileged user we run into an exception.

Expected Behavior

We should be able to run this from any user space, as we only register the application in the "Application" log and nowhere else

Current Behavior

The execution fails with the following error

Exception calling "SourceExists" with "1" argument(s): "The source was not found, but some or all event logs could not
be searched.  Inaccessible logs: Security."

At C:\Program 

Files\WindowsPowerShell\Modules\icinga-powershell-framework\lib\core\logging\Register-IcingaEventLog.psm1:3 char:5

+     $Registered = [System.Diagnostics.EventLog]::SourceExists(

+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : SecurityException

 

New-EventLog : Access is denied. Try running the command again in a session that has been opened with elevated user 

rights (that is, Run as Administrator).

At C:\Program 

Files\WindowsPowerShell\Modules\icinga-powershell-framework\lib\core\logging\Register-IcingaEventLog.psm1:11 char:5

+     New-EventLog -LogName Application -Source 'Icinga for Windows';

+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [New-EventLog], Exception

    + FullyQualifiedErrorId : AccessIsDenied,​Microsoft.PowerShell.Commands.NewEventLogCommand

Possible Solution

Add handling to catch this issue

Steps to Reproduce (for bugs)

  1. Install the Framework manually on a new system
  2. Run any check from this system
  3. The execution will fail with above mentioned error
@LordHepipud LordHepipud added the Bug There is an issue present label Jul 28, 2020
@LordHepipud LordHepipud added this to the v1.2.0 milestone Jul 28, 2020
@LordHepipud LordHepipud self-assigned this Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug There is an issue present
Projects
None yet
Development

No branches or pull requests

1 participant