This script allows you to automate the process of creating ransomware file screens with file server resource manager. The script is inteded to be deployed as part of a Configuration Baseline in SCCM and automates the following processes;

1. Installs the FSRM role on servers within the designated collection
2. Configures FSRM SMTP details
3. Creates a FSRM file group for ransomware types contained within a text file held on a UNC share
4. Creates FSRM templates and screens for the ransomware file group
5. Applies the FSRM screen to all hard disks (note that the system drive is marked as passive, all other drives are marked as blocked)
6. Sets automatic alerting of the file, user and path should some one attampt to write to one of the protected drives

Should someone attempt to save a file on a protected share, they will receive the following message;


File Blocked Message


At the same time, the designated admin will receive the following;


Administrative Email Alert


If you need to update the list of known ransomware extensions, simply update the text file and the SCCM CB will update all members of the collection on the next CB interval check.

Full blog post at



     Created with:     SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.135 
     Created on:       23/03/2017 14:00 
     Created by:       Maurice.Daly 
     Filename:         CrpytoBlocker.ps1 
        This powerschell script automatically adds the FSRM role and file groups,  
        templates and rules to aid in protecting against known ransomware file types. 
        In the event of a file being detected, the default action for non system 
        drives will be to block the file upon which an email is generated to the  
        systems administrator showing the user, file and path used for further  
        The script has been tested against Server 2012 - 2016. 
        The intended use of this script is with SCCM, however you can also use it  
        manually if your environment is not managed with SCCM. 
        Use : This script is provided as it and I accept no responsibility for any issues arising from its use. 
        Twitter : @modaly_it 
        Blog : 
        Store your FileExtensions.txt file on a file server and reference it in the  
        $CryptoExtensions variable 
        Setup a CI and CB as per the following blog arcticle : 
function CryptoBlocker 
    # Email Sever Settings 
    $AdminEmail = "Admin@YOURDOMAINNAME" 
    # Get Ransomware Known File Types 
    $CryptoExtensions = Get-Content "\\UNCFILESERVERPATH\FileExtensions.txt" 
    # Import Server Manager PS Module 
    Import-Module ServerManager 
    # Install FSRM Role if required 
    if ((Get-WindowsFeature -Name FS-Resource-Manager).InstallState -ne "Installed") 
        Install-WindowsFeature -Name FS-Resource-Manager -IncludeManagementTools | Out-Null 
    # Install Cyrpto Extension Monitoring / Blocking 
    if ((Get-FSRMFileScreen).Description -notcontains "Crypto Extension Monitoring") 
        # Set FSRM Email Settings 
        Set-FSRMSetting -AdminEmailAddress $AdminEmail -SMTPServer $SMTPServer -FromEmailAddress $SMTPFrom 
        # Create FSRM File Group 
        New-FSRMFileGroup -name "CryptoExtensions" -IncludePattern $CryptoExtensions -Description "Crypto Extension Detection" | Out-Null 
        # Set FRSM Notification Message & Scan Interval 
        $Notification = New-FSRMAction -Type Email -Subject "Crypto File Activity Detected - $env:COMPUTERNAME" -Body "User [Source IO Owner] attempted to save [Source File Path] to [File Screen Path] on the [Server] server. This file is in violation of the [Violated File Group] file group. This file could be a marker for malware infection, and should be investigated immediately." -RunLimitInterval 30 -MailTo $SMTPTo 
        # Create FSRM Template 
        New-FsrmFileScreenTemplate -Name CryptoExtensions -Description "Known CryptoLocker File Extesions" -IncludeGroup CryptoExtensions -Active: $true -Notification $Notification | Out-Null 
        # Build Drive Lists 
        $Drives = Get-WmiObject -Class Win32_LogicalDisk -Filter DriveType=3 | Select -ExpandProperty DeviceID 
        # Apply FSRM Screen 
        foreach ($Drive in $Drives) 
            New-FSRMFileScreen -Path $Drive -Active: $true -Description "Crypto Extension Monitoring" -Template CryptoExtensions -Notification $Notification | Out-Null 
    # Update Cyrpto File Extensions  
    if ((Get-FSRMFileScreen).Description -contains "Crypto Extension Monitoring") 
        # Create Array For File Extensions Already Imported 
        $CryptoExtensionsUpdate = New-Object -TypeName System.Collections.ArrayList 
        # Get Known Extensions 
        $KnownExtensions = Get-FSRMFileGroup -Name CryptoExtensions | select -ExpandProperty IncludePattern 
        # Add Known Extensions To $CryptoExtensions Array 
        foreach ($Extension in $CryptoExtensions) 
            If ($Extension -notin $KnownExtensions) 
                $CryptoExtensionsUpdate.Add($Extension| Out-Null 
        # Update File Screen 
        Set-FSRMFileGroup -Name CryptoExtensions -IncludePattern $CryptoExtensionsUpdate | Out-Null 
    # Check for FSRM File Screen 
    $CryptoScreen = Get-FSRMFileScreen | Where-Object { $_.Description -eq "Crypto Extension Monitoring" } 
    if ($CryptoScreen -gt $null) 
        $CryptoCICompliant = $true 
        $CryptoCICompliant = $false 
    Return $CryptoCICompliant