So konfigurieren Sie Windows Defender SmartScreen mit PowerShell

Wichtigste Erkenntnisse

  • Das Skript konfiguriert die Windows Defender SmartScreen-Einstellungen über ein lokales GPO.
  • Entwickelt für die Verwendung auf Windows-Systemen ab Windows 8.1 und Windows Server 2012 aufwärts.
  • Bietet Optionen, um den SmartScreen ein- oder auszuschalten und seine Stufe auf „Warnen“ oder „Sperren“ einzustellen
  • Die PowerShell-Automatisierung rationalisiert und standardisiert SmartScreen-Konfigurationen über mehrere Systeme hinweg.
  • Die ordnungsgemäße Ausführung erfordert administrative Rechte, andernfalls wird ein Fehler zurückgegeben.
  • Erstellen Sie vor der Bereitstellung immer eine Sicherungskopie der Registrierungsdaten und testen Sie das Skript unter kontrollierten Bedingungen.
  • Mit NinjaOne können solche Konfigurationsaufgaben in Unternehmensumgebungen weiter vereinfacht und verbessert werden.

Im Bereich der Unternehmens-IT-Sicherheit ist die Konfiguration der Einstellungen und Präferenzen von Tools von zentraler Bedeutung für die Gewährleistung einer lückenlosen Sicherheit. Eines dieser Tools, das oft eine sorgfältige Konfiguration erfordert, ist der Windows Defender SmartScreen. In diesem Beitrag wird ein PowerShell-Skript vorgestellt, mit dem Windows Defender SmartScreen einfach über ein lokales GPO konfiguriert werden kann.

Hintergrund

Der Windows Defender SmartScreen ist ein wichtiges Element im Windows-Ökosystem, das Benutzer:innen vor potenziell schädlichen Websites, Dateien, Anwendungen und mehr warnt. Der Bedarf an einem PowerShell-Skript zum Anpassen der Einstellungen für alle Benutzer in einem Unternehmen entsteht, wenn IT-Experten und Managed Service Provider (MSPs ) versuchen, die Einstellungen zu standardisieren und potenzielle Sicherheitslücken zu vermeiden.

Das Skript

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#Requires -Version 2.0
<#
.SYNOPSIS
Changes the SmartScreen state for all users via local GPO.
.DESCRIPTION
Changes the SmartScreen state for all users via local GPO.
Effected registry entries that are set:
HKLM:SoftwarePoliciesMicrosoftEdgeSmartScreenEnabled = 1
HKLM:SoftwarePoliciesMicrosoftWindowsSystemEnableSmartScreen = 1
HKLM:SoftwarePoliciesMicrosoftWindowsSystemShellSmartScreenLevel = Warn
HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterEnabledV9 = 1
HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverride = 1
HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverrideAppRepUnknown = 1
.EXAMPLE
-Off
Turn off SmartScreen
.EXAMPLE
-On
Turn on SmartScreen and Warn.
.EXAMPLE
-On -Level Block
Turn on SmartScreen and Block when it normally warns.
.EXAMPLE
PS C:> Set-SmartScreen.ps1 -Off
Turn off SmartScreen
.OUTPUTS
None
.NOTES
Minimum OS Architecture Supported: Windows 8.1, Windows Server 2012
Release Notes:
Fixes bug where registry wasn't being set correctly.
By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https://www.ninjaone.com/terms-of-use.
Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider.
Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).
.COMPONENT
OSSecurity
#>
[CmdletBinding(DefaultParameterSetName = "On")]
param (
[Parameter(Mandatory = $true, ParameterSetName = "On")]
[Switch]
$On,
[Parameter(Mandatory = $true, ParameterSetName = "Off")]
[Switch]
$Off,
[Parameter(Mandatory = $false, ParameterSetName = "On")]
[ValidateSet("Block", "Warn")]
[String]
$Level = "Warn"
)
begin {
function Test-IsElevated {
$id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$p = New-Object System.Security.Principal.WindowsPrincipal($id)
if ($p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator))
{ Write-Output $true }
else
{ Write-Output $false }
}
function Set-ItemProp {
param (
$Path,
$Name,
$Value,
[ValidateSet("DWord", "QWord", "String", "ExpandedString", "Binary", "MultiString", "Unknown")]
$PropertyType = "DWord"
)
New-Item -Path $Path -Force | Out-Null
if ((Get-ItemProperty -Path $Path -Name $Name -ErrorAction SilentlyContinue)) {
Set-ItemProperty -Path $Path -Name $Name -Value $Value -Force -Confirm:$false | Out-Null
}
else {
New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $PropertyType -Force -Confirm:$false | Out-Null
}
}
}
process {
if (-not (Test-IsElevated)) {
Write-Error -Message "Access Denied. Please run with Administrator privileges."
exit 1
}
# Set $State to 1 if -On was used or to 0 if -Off was used
$State = if ($On) { 1 }
elseif ($Off) { 0 }
else {
Write-Error ""
}
try {
Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "EnableSmartScreen" -Value $State
Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "ShellSmartScreenLevel" -Value $Level -PropertyType String
Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "EnabledV9" -Value $State
Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverride" -Value $State
Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverrideAppRepUnknown" -Value $State
# Uses: https://admx.help/?Category=EdgeChromium&Policy=Microsoft.Policies.Edge::SmartScreenEnabled
Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftEdge" -Name "SmartScreenEnabled" -Value $State
}
catch {
Write-Error $_
exit 1
}
Write-Host "Values change in Registry:"
# Output Proof of Work
@(
[PSCustomObject]@{
"Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftEdgeSmartScreenEnabled"
Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftEdge" -Name "SmartScreenEnabled" -ErrorAction SilentlyContinue)"
}
[PSCustomObject]@{
"Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftWindowsSystemEnableSmartScreen"
Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "EnableSmartScreen" -ErrorAction SilentlyContinue)"
}
[PSCustomObject]@{
"Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftWindowsSystemShellSmartScreenLevel"
Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "ShellSmartScreenLevel" -ErrorAction SilentlyContinue)"
}
[PSCustomObject]@{
"Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterEnabledV9"
Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "EnabledV9" -ErrorAction SilentlyContinue)"
}
[PSCustomObject]@{
"Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverride"
Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverride" -ErrorAction SilentlyContinue)"
}
[PSCustomObject]@{
"Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverrideAppRepUnknown"
Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverrideAppRepUnknown" -ErrorAction SilentlyContinue)"
}
)
gpupdate.exe /force
Write-Host "A reboot, or three, will be needed for this policy to take affect."
}
end {}
#Requires -Version 2.0 <# .SYNOPSIS Changes the SmartScreen state for all users via local GPO. .DESCRIPTION Changes the SmartScreen state for all users via local GPO. Effected registry entries that are set: HKLM:SoftwarePoliciesMicrosoftEdgeSmartScreenEnabled = 1 HKLM:SoftwarePoliciesMicrosoftWindowsSystemEnableSmartScreen = 1 HKLM:SoftwarePoliciesMicrosoftWindowsSystemShellSmartScreenLevel = Warn HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterEnabledV9 = 1 HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverride = 1 HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverrideAppRepUnknown = 1 .EXAMPLE -Off Turn off SmartScreen .EXAMPLE -On Turn on SmartScreen and Warn. .EXAMPLE -On -Level Block Turn on SmartScreen and Block when it normally warns. .EXAMPLE PS C:> Set-SmartScreen.ps1 -Off Turn off SmartScreen .OUTPUTS None .NOTES Minimum OS Architecture Supported: Windows 8.1, Windows Server 2012 Release Notes: Fixes bug where registry wasn't being set correctly. By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https://www.ninjaone.com/terms-of-use. Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA). .COMPONENT OSSecurity #> [CmdletBinding(DefaultParameterSetName = "On")] param ( [Parameter(Mandatory = $true, ParameterSetName = "On")] [Switch] $On, [Parameter(Mandatory = $true, ParameterSetName = "Off")] [Switch] $Off, [Parameter(Mandatory = $false, ParameterSetName = "On")] [ValidateSet("Block", "Warn")] [String] $Level = "Warn" ) begin { function Test-IsElevated { $id = [System.Security.Principal.WindowsIdentity]::GetCurrent() $p = New-Object System.Security.Principal.WindowsPrincipal($id) if ($p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Output $true } else { Write-Output $false } } function Set-ItemProp { param ( $Path, $Name, $Value, [ValidateSet("DWord", "QWord", "String", "ExpandedString", "Binary", "MultiString", "Unknown")] $PropertyType = "DWord" ) New-Item -Path $Path -Force | Out-Null if ((Get-ItemProperty -Path $Path -Name $Name -ErrorAction SilentlyContinue)) { Set-ItemProperty -Path $Path -Name $Name -Value $Value -Force -Confirm:$false | Out-Null } else { New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $PropertyType -Force -Confirm:$false | Out-Null } } } process { if (-not (Test-IsElevated)) { Write-Error -Message "Access Denied. Please run with Administrator privileges." exit 1 } # Set $State to 1 if -On was used or to 0 if -Off was used $State = if ($On) { 1 } elseif ($Off) { 0 } else { Write-Error "" } try { Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "EnableSmartScreen" -Value $State Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "ShellSmartScreenLevel" -Value $Level -PropertyType String Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "EnabledV9" -Value $State Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverride" -Value $State Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverrideAppRepUnknown" -Value $State # Uses: https://admx.help/?Category=EdgeChromium&Policy=Microsoft.Policies.Edge::SmartScreenEnabled Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftEdge" -Name "SmartScreenEnabled" -Value $State } catch { Write-Error $_ exit 1 } Write-Host "Values change in Registry:" # Output Proof of Work @( [PSCustomObject]@{ "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftEdgeSmartScreenEnabled" Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftEdge" -Name "SmartScreenEnabled" -ErrorAction SilentlyContinue)" } [PSCustomObject]@{ "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftWindowsSystemEnableSmartScreen" Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "EnableSmartScreen" -ErrorAction SilentlyContinue)" } [PSCustomObject]@{ "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftWindowsSystemShellSmartScreenLevel" Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "ShellSmartScreenLevel" -ErrorAction SilentlyContinue)" } [PSCustomObject]@{ "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterEnabledV9" Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "EnabledV9" -ErrorAction SilentlyContinue)" } [PSCustomObject]@{ "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverride" Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverride" -ErrorAction SilentlyContinue)" } [PSCustomObject]@{ "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverrideAppRepUnknown" Value = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverrideAppRepUnknown" -ErrorAction SilentlyContinue)" } ) gpupdate.exe /force Write-Host "A reboot, or three, will be needed for this policy to take affect." } end {}
#Requires -Version 2.0

<#
.SYNOPSIS
    Changes the SmartScreen state for all users via local GPO.
.DESCRIPTION
    Changes the SmartScreen state for all users via local GPO.
    Effected registry entries that are set:
    HKLM:SoftwarePoliciesMicrosoftEdgeSmartScreenEnabled = 1
    HKLM:SoftwarePoliciesMicrosoftWindowsSystemEnableSmartScreen = 1
    HKLM:SoftwarePoliciesMicrosoftWindowsSystemShellSmartScreenLevel = Warn
    HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterEnabledV9 = 1
    HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverride = 1
    HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverrideAppRepUnknown = 1
.EXAMPLE
     -Off
    Turn off SmartScreen
.EXAMPLE
     -On
    Turn on SmartScreen and Warn.
.EXAMPLE
     -On -Level Block
    Turn on SmartScreen and Block when it normally warns.
.EXAMPLE
    PS C:> Set-SmartScreen.ps1 -Off
    Turn off SmartScreen
.OUTPUTS
    None
.NOTES
    Minimum OS Architecture Supported: Windows 8.1, Windows Server 2012
    Release Notes:
    Fixes bug where registry wasn't being set correctly.
By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https://www.ninjaone.com/terms-of-use.
    Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. 
    Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. 
    Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. 
    Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. 
    Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. 
    Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. 
    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).
.COMPONENT
    OSSecurity
#>

[CmdletBinding(DefaultParameterSetName = "On")]
param (
    [Parameter(Mandatory = $true, ParameterSetName = "On")]
    [Switch]
    $On,
    [Parameter(Mandatory = $true, ParameterSetName = "Off")]
    [Switch]
    $Off,
    [Parameter(Mandatory = $false, ParameterSetName = "On")]
    [ValidateSet("Block", "Warn")]
    [String]
    $Level = "Warn"
)

begin {
    function Test-IsElevated {
        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()
        $p = New-Object System.Security.Principal.WindowsPrincipal($id)
        if ($p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator))
        { Write-Output $true }
        else
        { Write-Output $false }
    }
    function Set-ItemProp {
        param (
            $Path,
            $Name,
            $Value,
            [ValidateSet("DWord", "QWord", "String", "ExpandedString", "Binary", "MultiString", "Unknown")]
            $PropertyType = "DWord"
        )
        New-Item -Path $Path -Force | Out-Null
        if ((Get-ItemProperty -Path $Path -Name $Name -ErrorAction SilentlyContinue)) {
            Set-ItemProperty -Path $Path -Name $Name -Value $Value -Force -Confirm:$false | Out-Null
        }
        else {
            New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $PropertyType -Force -Confirm:$false | Out-Null
        }
    }
}
process {
    if (-not (Test-IsElevated)) {
        Write-Error -Message "Access Denied. Please run with Administrator privileges."
        exit 1
    }
    # Set $State to 1 if -On was used or to 0 if -Off was used
    $State = if ($On) { 1 }
    elseif ($Off) { 0 }
    else {
        Write-Error ""
    }
    try {
        Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "EnableSmartScreen" -Value $State
        Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "ShellSmartScreenLevel" -Value $Level -PropertyType String
        Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "EnabledV9" -Value $State
        Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverride" -Value $State
        Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverrideAppRepUnknown" -Value $State
        # Uses: https://admx.help/?Category=EdgeChromium&Policy=Microsoft.Policies.Edge::SmartScreenEnabled
        Set-ItemProp -Path "HKLM:SoftwarePoliciesMicrosoftEdge" -Name "SmartScreenEnabled" -Value $State
    }
    catch {
        Write-Error $_
        exit 1
    }
    Write-Host "Values change in Registry:"
    # Output Proof of Work
    @(
        [PSCustomObject]@{
            "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftEdgeSmartScreenEnabled"
            Value            = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftEdge" -Name "SmartScreenEnabled" -ErrorAction SilentlyContinue)"
        }
        [PSCustomObject]@{
            "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftWindowsSystemEnableSmartScreen"
            Value            = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "EnableSmartScreen" -ErrorAction SilentlyContinue)"
        }
        [PSCustomObject]@{
            "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftWindowsSystemShellSmartScreenLevel"
            Value            = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftWindowsSystem" -Name "ShellSmartScreenLevel" -ErrorAction SilentlyContinue)"
        }
        [PSCustomObject]@{
            "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterEnabledV9"
            Value            = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "EnabledV9" -ErrorAction SilentlyContinue)"
        }
        [PSCustomObject]@{
            "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverride"
            Value            = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverride" -ErrorAction SilentlyContinue)"
        }
        [PSCustomObject]@{
            "Registry Entry" = "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilterPreventOverrideAppRepUnknown"
            Value            = "$(Get-ItemPropertyValue -Path "HKLM:SoftwarePoliciesMicrosoftMicrosoftEdgePhishingFilter" -Name "PreventOverrideAppRepUnknown" -ErrorAction SilentlyContinue)"
        }
    )
    gpupdate.exe /force
    Write-Host "A reboot, or three, will be needed for this policy to take affect."
}
end {}

 

Zugriff auf über 300 Skripte im NinjaOne Dojo

Zugang erhalten

Detailansicht

Das bereitgestellte Skript zielt darauf ab, den SmartScreen-Status für alle Benutzer:innen zu ändern. Es funktioniert, indem es bestimmte Einträge in der Registrierung anpasst. Im Folgenden wird die Funktionsweise des Skripts Schritt für Schritt erläutert:

  • Ersteinrichtung: Das Skript beginnt mit der Angabe der gewünschten Version und gibt einen kurzen Überblick über ihre Funktionsweise.
  • Cmdlet-Bindung und Parameter: Der Benutzer kann das Skript entweder mit den Parametern -On oder -Off ausführen. Darüber hinaus können Benutzer:innen mit dem Parameter -Level zwischen dem Status „Warnen“ oder „Sperren“ für den SmartScreen entscheiden.
  • Unterstützende Funktionen:
  • Test-IsElevated prüft, ob das Skript mit administrativen Rechten ausgeführt wird.
  • Set-ItemProp erstellt oder ändert Einträge in der Registrierung.
  • Hauptprozess:
  • Das Skript prüft zunächst, ob es mit den erforderlichen Berechtigungen ausgeführt wird.
  • Je nach Benutzereingabe setzt das Skript dann den Status von SmartScreen und ändert die entsprechenden Registrierungseinträge.
  • Dem Benutzer wird eine Ausgabe mit den geänderten Registrierungswerten angezeigt.
  • Schließlich ruft das Skript gpupdate.exe auf, um eine Aktualisierung der Gruppenrichtlinien zu erzwingen, und erinnert die Benutzer:innen daran, dass möglicherweise ein Neustart erforderlich ist.

Potenzielle Anwendungsfälle

Stellen Sie sich ein Unternehmen vor, in dem eine neue Sicherheitsrichtlinie vorschreibt, dass auf allen Computern der Windows Defender SmartScreen aktiviert und auf „Blockieren“ eingestellt sein muss. Anstatt jeden einzelnen Computer manuell zu konfigurieren, kann ein IT-Experte dieses Skript einsetzen, um die Einstellungen massenhaft anzupassen und so Einheitlichkeit und Konformität auf allen Geräten zu gewährleisten.

Vergleiche

Obwohl Gruppenrichtlinienobjekte (GPO) von der Gruppenrichtlinien-Verwaltungskonsole (GPMC ) auch SmartScreen-Einstellungen konfigurieren können, optimiert dieses PowerShell-Skript den Prozess. Anstatt durch mehrere Fenster und Einstellungen in GPMC zu navigieren, können IT-Experten ein einziges Skript ausführen, was Zeit spart und mögliche Fehler reduziert.

FAQs

  • Kann dieses Skript auf jedem Rechner ausgeführt werden?
    Das Skript ist für Windows-Systeme ab Windows 8.1 und Windows Server 2012 zugeschnitten.
  • Was passiert, wenn ich das Skript nicht als Administrator ausführe?
    Das Skript gibt eine Fehlermeldung „Zugriff verweigert“ aus und fordert den Benutzer auf, das Skript mit den richtigen Berechtigungen auszuführen.

Auswirkungen

Die erfolgreiche Konfiguration des SmartScreen-Status im gesamten Unternehmen erhöht die IT-Sicherheit und verringert die Risiken im Zusammenhang mit schädlichen Downloads oder Websites. Eine falsche Konfiguration kann jedoch dazu führen, dass Systeme Bedrohungen ausgesetzt sind oder zu viele falsche Warnungen ausgegeben werden, was die Arbeit behindert.

Empfehlungen

  • Erstellen Sie immer eine Sicherungskopie Ihres aktuellen Registrierungsstatus, bevor Sie Änderungen vornehmen.
  • Testen Sie das Skript gründlich in einer kontrollierten Umgebung, bevor Sie es unternehmensweit einführen.
  • Überwachen Sie die Einstellungen kontinuierlich und passen Sie sie an die Bedürfnisse des Unternehmens an.

Abschließende Überlegungen

Für IT-Experten, die eine nahtlose Lösung für solche Konfigurationen suchen, können Tools wie NinjaOne erweiterte Funktionen bieten. Durch die Integration von Skripten wie dem hier beschriebenen kann NinjaOne bei der Automatisierung, Verwaltung und Überwachung von IT-Aufgaben im gesamten Unternehmen helfen und so einen optimierten und sicheren Betrieb gewährleisten.

Next Steps

Building an efficient and effective IT team requires a centralized solution that acts as your core service delivery tool. NinjaOne enables IT teams to monitor, manage, secure, and support all their devices, wherever they are, without the need for complex on-premises infrastructure.

Learn more about NinjaOne Remote Script Deployment, check out a live tour, or start your free trial of the NinjaOne platform.

Kategorien:

Das könnte Sie auch interessieren

×

Sehen Sie NinjaOne in Aktion!

Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld wird bei der Anzeige des Formulars ausgeblendet
Dieses Feld dient zur Validierung und sollte nicht verändert werden.

Mit dem Absenden dieses Formulars akzeptiere ich die Datenschutzerklärung von NinjaOne.