簡體   English   中英

如何導出集群計划任務

[英]How to Export Clustered Scheduled Task

我嘗試導出集群計划任務的 XML。

我搜索 function,因為 Export-ScheduledTask 用於非集群任務。

當我執行 Get-ClusteredScheduledTask 時,也許有一種通過 CIM 的方法我得到了這個。

但我不知道如何查詢這個

CimClass              : Root/Microsoft/Windows/TaskScheduler:MSFT_ClusteredScheduledTask
CimInstanceProperties : {ClusterName, CurrentOwner, Resource, TaskDefinition...}
CimSystemProperties   : Microsoft.Management.Infrastructure.CimSystemProperties

編輯1:

獲取會員

$task | Get-Member


   TypeName: Microsoft.Management.Infrastructure.CimInstance#Root/Microsoft/Windows/TaskScheduler/MSFT_ClusteredScheduledTask

Name                      MemberType     Definition                                                                                                                      
----                      ----------     ----------                                                                                                                      
Clone                     Method         System.Object ICloneable.Clone()                                                                                                
Dispose                   Method         void Dispose(), void IDisposable.Dispose()                                                                                      
Equals                    Method         bool Equals(System.Object obj)                                                                                                  
GetCimSessionComputerName Method         string GetCimSessionComputerName()                                                                                              
GetCimSessionInstanceId   Method         guid GetCimSessionInstanceId()                                                                                                  
GetHashCode               Method         int GetHashCode()                                                                                                               
GetObjectData             Method         void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context...
GetType                   Method         type GetType()                                                                                                                  
ToString                  Method         string ToString()                                                                                                               
ClusterName               Property       string ClusterName {get;}                                                                                                       
CurrentOwner              Property       string CurrentOwner {get;}                                                                                                      
PSComputerName            Property       string PSComputerName {get;}                                                                                                    
Resource                  Property       string Resource {get;}                                                                                                          
TaskDefinition            Property       CimInstance#Instance TaskDefinition {get;set;}                                                                                  
TaskName                  Property       string TaskName {get;}                                                                                                          
TaskType                  ScriptProperty System.Object TaskType {get=[Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ClusterTaskTypeEnum]($this.PSBas...

試試這個 $TaskName = "Change_NTFS_permissions"

Get-ChildItem -Path ($env:SystemRoot + '\System32\Tasks\Microsoft\Windows\Failover Clustering') -File -Recurse |? {$_.Name -like $TaskName} | 獲取內容 | 輸出文件 -FilePath ('C:\scripts\XML_Shedules' + '' + $TaskName + '.xml')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM