ComputerManagementDsc
ComputerManagementDsc copied to clipboard
Resource to handle SmartScreen Filter
I used this script to turn off Smart Screen filter. I suggest we make this into a resource, or add this as a parameter to an existing resource. I do not know if this module is the correct one for this. If not, let me know and I will submit this in the correct module.
If there is a better way to accomplish this, then please let me know. 😄
Script (New-ResourceName -Name 'EnableSmartScreenFilter')
{
SetScript = {
<#
'Off' equals off.
'Prompt' equals 'Warn before running an unrecognized app, but don't require administrator approval'.
'RequireAdmin' equals 'Get administrator approval before running an unrecognizd app from the Internet (recommended)'
#>
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name SmartScreenEnabled -ErrorAction Stop -Value 'RequireAdmin' -Force
}
TestScript = {
$smartFilterStatus = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' -Name SmartScreenEnabled -ErrorAction SilentlyContinue).SmartScreenEnabled
return ($smartFilterStatus -eq 'RequireAdmin')
}
GetScript = {
$smartFilterStatus = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' -Name SmartScreenEnabled -ErrorAction SilentlyContinue).SmartScreenEnabled
return @{
SmartFilterStatus = $smartFilterStatus
}
}
}
@johlju - sounds like a good idea - and a really easy one to do if someone is looking for something easy to start with. Especially as you've provided much of the code :grin: