UWF_Servicing

這個類別包含屬性和方法,可讓您查詢和控制整合寫入篩選器 (UWF) 服務模式。

語法

class UWF_Servicing {
    [key, read] boolean CurrentSession;
    [read] boolean ServicingEnabled;

    UInt32 Enable();
    UInt32 Disable();
    UInt32 UpdateWindows(
        [out] UInt32 UpdateStatus
    );
};

成員

下表列出屬於這個類別的方法和屬性。

方法

方法 描述
UWF_Servicing.Disable 停用整合寫入篩選器 (UWF) 服務模式。
系統會在重新啟動後的下一個會話中離開維護模式。
UWF_Servicing.Enable 啟用整合寫入篩選器 (UWF) 服務模式。
系統會在下一個重新啟動後的會話中進入服務模式。
UWF_Servicing.UpdateWindows 呼叫 Windows Update,以下載並安裝執行 Windows 10 企業版 之裝置的重要和安全性更新。

屬性

屬性 資料類型 限定詞 描述和
CurrentSession 布林值 [key, read] 指出何時啟用服務。
- 如果在目前的會話
- 中啟用服務,則為 True 如果服務將在重新啟動後的會話中啟用,則為 False。
ServiceEnabled 布林值 [read] 指出系統是否處於目前會話中的服務模式,或將在重新啟動后的下一個會話中處於維護模式。
- 如果已啟用
服務,則為 True
,否則為 False

備註

這個類別只有兩個實例,一個用於目前的會話,另一個實例則用於重新啟動之後的下一個會話。

範例

下列範例示範如何在PowerShell腳本中使用Windows Management Instrumentation (WMI) 提供者,在裝置上啟用和停用 UWF 服務模式。

$COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"

# Define common parameters

$CommonParams = @{"namespace"=$NAMESPACE; "computer"=$COMPUTER}

# Enable UWF servicing

$nextSession = Get-WmiObject -class UWF_Servicing @CommonParams | where {
    $_.CurrentSession -eq $false
}

if ($nextSession) {

    $nextSession.Enable() | Out-Null;
    Write-Host "This device is enabled for servicing mode after the next restart."
}

# Disable UWF servicing

$nextSession = Get-WmiObject -class UWF_Servicing @CommonParams | where {
    $_.CurrentSession -eq $false
}

if ($nextSession) {

    $nextSession.Disable() | Out-Null;
    Write-Host "Servicing mode is now disabled for this device."
}

需求

Windows 版本 支援
Windows Home No
Windows 專業版 No
Windows 企業版 Yes
Windows 教育版 Yes
Windows IoT 企業版 是的