Синий экран при включении единого фильтра записи - PullRequest
0 голосов
/ 05 октября 2019

Итак, мы переходим от Deep Freeze к Unified Write Filter. Я прочитал Microsoft Docs , и это кажется довольно простым для включения. Я делаю это в PowerShell с помощью вызовов WMI и uwfmgr.exe вместе взятых. Мы в высшем образовании, так что вы можете себе представить, что есть разные изображения.

В базовом общедоступном образе у нас есть базовое программное обеспечение, такое как Acrobat Reader, Chrome и Office. Есть несколько параметров, установленных GPO, но ничто не должно блокировать это. Я загружаю скрипт в этом базовом образе, и он работает просто отлично. Компьютер перезагружается, и фильтр работает как положено

Затем я решил проверить это на более качественном изображении с помощью основного программного обеспечения, а также нескольких других, таких как Anaconda3, IntelliJ и PyCharm. Также включена поддержка Hyper-V. Это когда я запускаю скрипт, а затем получаю BSOD. Ошибка:

SYSTEM THREAD EXCEPTION NOT HANDLED 
What failed uwfs.sys

Оба аппаратных средства абсолютно одинаковы: процессор i5, 8 ГБ ОЗУ, 256 SSD. Оба работают под управлением Windows 10 LTSC 1809 с последними исправлениями. Моей первой мыслью было, что Hyper-V может вызывать проблемы, но это не так, потому что базовая версия прекрасно работает с Hyper-V. Я даже могу создать виртуальные машины, перезагрузить хост, и виртуальные машины исчезли. Тогда я подумал, что это может быть пространство. Свободное место на жесткой коробке составляет 107 ГБ, поэтому я установил оверлей на 10 ГБ. Я получаю то же самое. Я не вижу никакой другой программы, которая может копаться в системе, как Hyper-V.

Вот код:

$COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"
$filePath = "\\share"
$excludeFiles = Get-Content "$filePath\exclude-file.txt"
$excludeReg = Get-Content "$filePath\exclude-reg.txt"
if (-not (Test-Path C:\UWF\)) {
    New-Item -ItemType Directory -Path C:\UWF | Out-Null
}
$logfile = "$filePath\logfile_$($env:COMPUTERNAME)_" + (Get-Date -Format yyyyMMdd) + ".log"
# Define common parameters

$CommonParams = @{"namespace" = $NAMESPACE; "computer" = $COMPUTER }
function updateLog {
    $text = $args[0]
    $final = "[$((Get-Date -Format "MM/dd/yy HH:mm:ss"))] $text"
    $final | Add-Content $logFile
}
function Enable-UWF() {

    # Retrieve the UWF_Filter settings.
    $objUWFInstance = Get-WmiObject -namespace $NAMESPACE -class UWF_Filter;

    if (!$objUWFInstance) {
        updatelog "Unable to retrieve Unified Write Filter settings."
        return;
    }
    # Call the method to enable UWF after the next restart.  This sets the NextEnabled property to false.

    $retval = $objUWFInstance.Enable();

    # Check the return value to verify that the enable is successful
    if ($retval.ReturnValue -eq 0) {
        updateLog   "Unified Write Filter will be enabled after the next system restart."
    }
    else {
        updatelog   "Unknown Error: " + "{0:x0}" -f $retval.ReturnValue
    }
}
function Set-ProtectVolume($driveLetter, [bool] $enabled) {

    # Each volume has two entries in UWF_Volume, one for the current session and one for the next session after a restart
    # You can only change the protection status of a drive for the next session

    $nextConfig = Get-WmiObject -class UWF_Volume @CommonParams |
        Where-Object {
            $_.DriveLetter -eq "$driveLetter" -and $_.CurrentSession -eq $false
        };

    # If a volume entry is found for the drive letter, enable or disable protection based on the $enabled parameter

    if ($nextConfig) {

        updatelog "Setting drive protection on $driveLetter to $enabled"

        if ($Enabled -eq $true) {
            $nextConfig.Protect() | Out-Null;
            updateLog "Protection has been enabled"
        }
        else {
            $nextConfig.Unprotect() | Out-Null;
        }
    }

    # If the drive letter does not match a volume, create a new UWF_volume instance

    else {
        updatelog "Error: Could not find $driveLetter. Protection is not enabled."
    }
}
function Set-OverlayWarningThreshold($ThresholdSize) {

    # Retrieve the overlay WMI object

    $OverlayInstance = Get-WmiObject -namespace $NAMESPACE -class UWF_Overlay;

    if (!$OverlayInstance) {
        "Unable to get handle to an instance of the UWF_Overlay class"
        return;
    }

    # Call the instance method to set the warning threshold value

    $retval = $OverlayInstance.SetWarningThreshold($ThresholdSize);

    # Check the return value to verify that setting the warning threshold is successful

    if ($retval.ReturnValue -eq 0) {
        updateLog  "Overlay critical threshold has been set to $($ThresholdSize)MB"
    }
    else {
        updateLog  "Unknown Error: $retval.ReturnValue"
    }
}
function Set-OverlayCriticalThreshold($ThresholdSize) {

    # Retrieve the overlay WMI object

    $OverlayInstance = Get-WmiObject -namespace $NAMESPACE -class UWF_Overlay;

    if (!$OverlayInstance) {
        "Unable to get handle to an instance of the UWF_Overlay class"
        return;
    }

    # Call the instance method to set the warning threshold value

    $retval = $OverlayInstance.SetCriticalThreshold($ThresholdSize);

    # Check the return value to verify that setting the critical threshold is successful

    if ($retval.ReturnValue -eq 0) {
        updateLog  "Overlay critical threshold has been set to $($ThresholdSize)MB"
    }
    else {
        updateLog  "Unknown Error: $retval.ReturnValue"
    }
}
function Get-OverlayInformation() {

    # Retrieve the Overlay WMI object

    $OverlayInstance = Get-WmiObject -namespace $NAMESPACE -class UWF_Overlay;

    if (!$OverlayInstance) {
        "Unable to get handle to an instance of the UWF_Overlay class"
        return;
    }

    # Display the current values of the overlay properties

    "`nOverlay Consumption: " + $OverlayInstance.OverlayConsumption
    "Available Space: " + $OverlayInstance.AvailableSpace
    "Critical Overlay Threshold: " + $OverlayInstance.CriticalOverlayThreshold
    "Warning Overlay Threshold: " + $OverlayInstance.WarningOverlayThreshold
}    

#Actual commands to start process
Enable-WindowsOptionalFeature -Online -FeatureName "Client-UnifiedWriteFilter" -All
Enable-UWF
& uwfmgr.exe overlay set-size 20000
updateLog "Set Overlay size to 20GB"
& uwfmgr.exe overlay set-type disk
updatelog "Set Overlay type to DISK"
Set-OverlayWarningThreshold(10000)
Set-OverlayCriticalThreshold(18000)
foreach ($file in $excludeFiles) {
    & uwfmgr file Add-Exclusion `"$($file)`"
    updateLog "Added file exclusion for $file"
}
foreach ($reg in $excludeReg) {
    & uwfmgr registry Add-Exclusion `"$($reg)`"
    updateLog "Added registry exclusion for $reg"
}
Set-ProtectVolume "C:" $true
Restart-Computer -Force
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...