WindowsProcess
概要
啟動或停止 Windows 進程。
語法
WindowsProcess [String] #ResourceName
{
Arguments = [string]
Path = [string]
[Credential = [PSCredential]]
[DependsOn = [string[]]]
[Ensure = [string]{ Absent | Present }]
[PsDscRunAsCredential = [PSCredential]]
[StandardErrorPath = [string]]
[StandardInputPath = [string]]
[StandardOutputPath = [string]]
[WorkingDirectory = [string]]
}
描述
資源 WindowsProcess
可讓您確保進程是否正在執行。
規格需求
無。
金鑰屬性
引數
指定要在啟動為字串時傳遞至進程的完整引數清單。 如果進程不需要任何引數,請將此屬性設定為空字串 ''
() 。
Type: System.String
路徑
指定進程可執行檔的路徑。 如果檔案可透過 PATH
環境變數存取,您可以將此屬性設定為可執行檔的名稱。 否則,請將此屬性設定為檔案的完整路徑。 不支援相對路徑。
Type: System.String
選擇性屬性
認證
指定要執行進程之帳戶的認證。
如果此屬性設定為本機系統帳戶,則無法設定 StandardOutputPath、 StandardInputPath或 WorkingDirectory 屬性。 如果您這麼做,資源會擲回不正確引數例外狀況。
Type: System.Management.Automation.PSCredential
Default Value: None
Ensure
指定進程是否應該執行。 如果這個屬性未執行,請將此屬性設定為 Present
以啟動進程。 將此屬性設定為 , Absent
以在進程執行時停止進程。
預設值是 Present
。
Type: System.String
Accepted Values:
- Absent
- Present
Default Value: Present
StandardErrorPath
指定檔案的完整路徑,讓進程寫入其標準錯誤資料流程。 不支援相對路徑。 如果檔案存在,則會遭到覆寫。
將 Ensure 屬性設定為 Absent
時,請勿設定此屬性。 如果您這麼做,資源會擲回不正確引數例外狀況。
Type: System.String
Default Value: None
StandardInputPath
指定檔案的完整路徑,讓進程讀取為其標準輸入資料流程。 不支援相對路徑。
將 Ensure 屬性設定為 Absent
或 將 Credential 屬性設定為本機系統帳戶時,請勿設定此屬性。 如果您這麼做,資源會擲回不正確引數例外狀況。
Type: System.String
Default Value: None
StandardOutputPath
指定檔案的完整路徑,讓進程寫入其標準輸出資料流程。 不支援相對路徑。 如果檔案存在,則會遭到覆寫。
將 Ensure 屬性設定為 Absent
或 將 Credential 屬性設定為本機系統帳戶時,請勿設定此屬性。 如果您這麼做,資源會擲回不正確引數例外狀況。
Type: System.String
Default Value: None
WorkingDirectory
為進程的工作目錄指定資料夾的完整路徑。 不支援相對路徑。
將 Ensure 屬性設定為 Absent
或 將 Credential 屬性設定為本機系統帳戶時,請勿設定此屬性。 如果您這麼做,資源會擲回不正確引數例外狀況。
Type: System.String
Default Value: None
唯讀屬性
HandleCount
進程開啟的控制碼數目。
Type: System.Int32
Behavior: Read
NonPagedMemorySize
為進程配置的非分頁式記憶體數量,以位元組為單位。
Type: System.UInt64
Behavior: Read
PagedMemorySize
為進程配置的分頁記憶體數量,以位元組為單位。
Type: System.UInt64
Behavior: Read
ProcessCount
正在執行之指定進程的實例數目。
Type: System.Int32
Behavior: Read
ProcessId
進程的唯一識別碼。
Type: System.Int32
Behavior: Read
VirtualMemorySize
為進程配置的虛擬記憶體數量,以位元組為單位。
Type: System.UInt64
Behavior: Read
範例
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應