Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
If ($Filter)
{ If ($Filter.ToUpper().IndexOf($Property.ToUpper()) -ge 0)
{ $Filter = $Filter.ToUpper().Replace($Property.ToUpper(),"`$Value")
Try {
[scriptblock]$Filter = [scriptblock]::Create($Filter)
}
Catch {
Write-Warning "$(Get-Date): ""$Filter"" caused an error, stopping script!"
Write-Warning $Error[0]
Exit
}
}
Else
{ Write-Warning "Could not locate $Property in the Filter, which is required. Filter: $Filter"
Exit
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment