Line 30, the *s around .NET are not necessary and break the removal portion of the script.
With the -NoMatch operator on the following lines (31-33), it is already matching parts of strings in the $WhitelistedApps string. The *s are NOT wildcards in the context of PowerShell -Match or -NoMatch regex.
If you wanted to, you cold change the -Match to a -Like, which uses simplified Powershell regex language, where the *s are wildcards, and where partial string matching is not already implied.
Otherwise, just remove the *s around .NET and that should fix the script.
Line 30, the
*
s around.NET
are not necessary and break the removal portion of the script.With the
-NoMatch
operator on the following lines (31-33), it is already matching parts of strings in the$WhitelistedApps
string. The*
s are NOT wildcards in the context of PowerShell-Match
or-NoMatch
regex.If you wanted to, you cold change the
-Match
to a-Like
, which uses simplified Powershell regex language, where the*
s are wildcards, and where partial string matching is not already implied.Otherwise, just remove the
*
s around.NET
and that should fix the script.[regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint|Microsoft.WindowsCamera|*.NET*'