Had a Powershell script working for some time now and noticed this morning it isn't working. I am seeing this error:
Specified argument was out of the range of valid values.
Parameter name: length
At C:\Users\xxx\Desktop\UserAudit - 4-2-15 Backup.ps1:202 char:5
+ $EventLogQuery = @"
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: ) [], ArgumentOutOfRangeException
+ FullyQualifiedErrorId : System.ArgumentOutOfRangeException
This error gets thrown when it approaches this step/variable assignemtn:
At one point, I know this was working...so I am a little confused on whats its not liking about the $EventLogQuery variable assignment? If I comment out the variable assignment, no errors are thrown.
This is a Powershell script that uses XPath to fetch specific EventLog messages.
Specified argument was out of the range of valid values.
Parameter name: length
At C:\Users\xxx\Desktop\UserAudit - 4-2-15 Backup.ps1:202 char:5
+ $EventLogQuery = @"
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: ) [], ArgumentOutOfRangeException
+ FullyQualifiedErrorId : System.ArgumentOutOfRangeException
This error gets thrown when it approaches this step/variable assignemtn:
Code:
$EventLogQuery = @"
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[EventData[Data[@Name='LogonType'] and (Data ='10')]]
and
*[System[(EventID='4624')]]
</Select>
<Suppress Path="Security">
*[EventData[Data[@Name='TargetUserName'] = 'SolarWinds.Admin']]
or
*[EventData[Data[@Name='TargetUserName'] = 'Administrator']]
</Suppress>
</Query>
<Query Id="1" Path="Security">
<Select Path="Security">
*[System[(EventID='4647')]]
</Select>
<Suppress Path="Security">
*[EventData[Data[@Name='TargetUserName'] = 'SolarWinds.Admin']]
or
*[EventData[Data[@Name='TargetUserName'] = 'Administrator']]
</Suppress>
</Query>
</QueryList>
"@
At one point, I know this was working...so I am a little confused on whats its not liking about the $EventLogQuery variable assignment? If I comment out the variable assignment, no errors are thrown.
This is a Powershell script that uses XPath to fetch specific EventLog messages.