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.
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:
And the error:
Thanks
W.