Open kp-bit opened 4 days ago
Are you just getting an error that the keyword isn't recognized? I tried this on the latest and it's working.
filter Get-ErrorLog ([switch]$Message)
{
if ($Message) { Out-Host -InputObject $_.Message }
else { $_ }
}
Get-WinEvent -LogName System -MaxEvents 100 | Get-ErrorLog -Message
The specific filter that fails is this one (works fine when changed to function):
filter GetPageUrl {
$pageUrl = "$_".ToLower() -ireplace $script:rootPathPattern, '' -ireplace '\\', '/' -ireplace ' ', '-' -ireplace '\.ps1|\.udpage\.ps1', ''
if ($pageUrl -eq '') {
$pageUrl = '/'
}
$pageUrl
}
The error looks like this:
Where are you defining your function? If I define it in the functions tab, it works.
If I define it in the main app code, it doesn't.
I can fix that, but you should be able to work around by putting it in the function tab. It effectively is a module that is loaded into the app.
Description of Issue
The filter keyword is no longer recognized in PSU v5, it was working fine in the beta but after upgrading it no longer works. We can get around it for now by using function instead as we only have v5 on a test server currently.
More information: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions?view=powershell-7.4#filters
Version
5.0.13
Severity
Medium
Hosting Method
MSI (Windows Service)
Operating System
Windows
Database
SQLite
Features
Additional Environment data
Using integrated PowerShell
Screenshots/Animations
n/a