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

Resource should not error if the log is already enabled #17

Open
arcotek-ltd opened this issue Dec 10, 2017 · 0 comments
Open

Resource should not error if the log is already enabled #17

arcotek-ltd opened this issue Dec 10, 2017 · 0 comments
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@arcotek-ltd
Copy link

I am finding this resource errors if a log is already enabled. Surely, it should just report "Enabled. Nothing to do" or words to that effect?

Usage example:

xWinEventLog "Enable-DscAnalytic"
        {
            LogName = 'Microsoft-Windows-Dsc/Analytic'
            IsEnabled = $True
            LogMode = "AutoBackup"
            MaximumSizeInBytes = 2048mb
            LogFilePath = "%SystemRoot%\System32\Winevt\Logs\Microsoft-Windows-DSC%4Analytic.evtx"
        }

And the error:

PowerShell DSC resource MSFT_xWinEventLog  failed to execute Set-TargetResource functionality with error message: System.Management.Automation.MethodInvocationException: Exception calling "SaveChanges" with "0" argument(s): 
"The requested operation cannot be performed over an enabled direct channel. The channel must first be disabled before performing the requested operation" ---> System.Diagnostics.Eventing.Reader.EventLogException: The requested 
operation cannot be performed over an enabled direct channel. The channel must first be disabled before performing the requested operation
   at System.Diagnostics.Eventing.Reader.EventLogException.Throw(Int32 errorCode)
   at System.Diagnostics.Eventing.Reader.NativeWrapper.EvtSaveChannelConfig(EventLogHandle channelConfig, Int32 flags)
   at CallSite.Target(Closure , CallSite , Object )
   --- End of inner exception stack trace ---
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
   at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
   at System.Management.Automation.CommandProcessorBase.Complete() 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : LocalHost

Thanks

W.

@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

1 participant