You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prompts you for confirmation before running the cmdlet.
109
+
Prompts you for confirmation before running the cmdlet. The default value is **True** and asks for confirmation. If you do not want to confirm the operation, you must use the switch with the **False** value, as shown in this example:
The -ForceDrain switch, used in conjunction with the -Drain switch, allows all the workloads to be safely moved to other nodes, while maintaining the highest levels of availability and using the best placement logic.
130
+
131
+
If some or all of the workloads can't be moved safely, any workload that failed will be stopped and moved to another node as a failed role. Thereafter, the node will be forced to pause.
Specifies an array of one or more names of a scheduled task.
97
+
Specifies an array of one or more names of a scheduled task. You can use **"*"** for a wildcard character query.
98
98
99
99
```yaml
100
100
Type: String[]
@@ -105,12 +105,12 @@ Required: False
105
105
Position: 0
106
106
Default value: None
107
107
Accept pipeline input: True (ByPropertyName)
108
-
Accept wildcard characters: False
108
+
Accept wildcard characters: True
109
109
```
110
110
111
111
### -TaskPath
112
-
Specifies an array of one or more paths for scheduled tasks in Task Scheduler namespace.
113
-
You can use **\** for the root folder.
112
+
Specifies an array of one or more paths for scheduled tasks in Task Scheduler namespace. You can use **"*"** for a wildcard character query.
113
+
You can use ***\\\*** for the root folder.
114
114
If you do not specify a path, the cmdlet uses the root folder.
115
115
116
116
```yaml
@@ -122,12 +122,12 @@ Required: False
122
122
Position: 1
123
123
Default value: None
124
124
Accept pipeline input: True (ByPropertyName)
125
-
Accept wildcard characters: False
125
+
Accept wildcard characters: True
126
126
```
127
127
128
128
### -ThrottleLimit
129
129
Specifies the maximum number of concurrent operations that can be established to run the cmdlet.
130
-
If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer.
130
+
If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer.
131
131
The throttle limit applies only to the current cmdlet, not to the session or to the computer.
The second command creates scheduled task settings that use the default settings and assigns the **ScheduledTaskSettings** object to the $Stset variable.
54
53
PS C:\>$STSet = New-ScheduledTaskSettingsSet
55
54
56
-
The third command registers the scheduled task Task01 to run the task action named Cmd and to use the default task settings.
The first command creates a scheduled task action named Cmd and assigns the ScheduledTaskAction object to the $Sta variable.
59
+
60
+
The second command creates scheduled task settings that use the default settings and assigns the **ScheduledTaskSettings** object to the $Stset variable.
61
+
62
+
The third command registers the scheduled task Task01 to run the task action named Cmd and to use the default task settings.
59
63
60
64
This example registers a scheduled task that uses default task settings.
61
65
@@ -65,12 +69,16 @@ The first command creates a scheduled task action named Cmd and assigns the **Sc
The second command creates scheduled task settings that sets a higher priority for the scheduled task, and assigns the **ScheduledTaskSettings** object to the $Stset variable.
The first command creates a scheduled task action named Cmd and assigns the ScheduledTaskAction object to the $Sta variable.
78
+
79
+
The second command creates scheduled task settings that sets a higher priority for the scheduled task, and assigns the **ScheduledTaskSettings** object to the $Stset variable.
80
+
81
+
The third command registers the scheduled task Task01 to run the task action named Cmd and to use the task settings that have a priority setting of 9.
74
82
75
83
This example sets the priority of a scheduled task.
76
84
@@ -80,12 +88,16 @@ The first command creates a scheduled task action named Cmd and assigns the **Sc
The second command creates scheduled task settings that specify that Task Scheduler attempts three restarts of the task at sixty minute intervals. This command assigns the **ScheduledTaskSettings** object to the $Stset variable.
The third command registers the scheduled task Task01 to run the task action named Cmd and to use the task settings that the **ScheduledTaskSettings** object defines.
The first command creates a scheduled task action named Cmd and assigns the ScheduledTaskAction object to the $Sta variable.
97
+
98
+
The second command creates scheduled task settings that specify that Task Scheduler attempts three restarts of the task at sixty minute intervals. This command assigns the **ScheduledTaskSettings** object to the $Stset variable.
99
+
100
+
The third command registers the scheduled task Task01 to run the task action named Cmd and to use the task settings that the **ScheduledTaskSettings** object defines.
89
101
90
102
This example sets restart settings for a scheduled task.
91
103
@@ -95,12 +107,16 @@ The first command creates a scheduled task action named Cmd and assigns the **Sc
The second command creates scheduled task settings that specify that Task Scheduler runs the task only when the computer is idle for 2 minutes and waits for 2 hours and 30 minutes for an idle condition. This command assigns the **ScheduledTaskSettings** object to the $Stset variable.
The third command registers the scheduled task Task01 to run the task action named Cmd and to use the task settings that the **ScheduledTaskSettings** object defines.
The first command creates a scheduled task action named Cmd and assigns the ScheduledTaskAction object to the $Sta variable.
116
+
117
+
The second command creates scheduled task settings that specify that Task Scheduler runs the task only when the computer is idle for 2 minutes and waits for 2 hours and 30 minutes for an idle condition. This command assigns the **ScheduledTaskSettings** object to the $Stset variable.
118
+
119
+
The third command registers the scheduled task Task01 to run the task action named Cmd and to use the task settings that the **ScheduledTaskSettings** object defines.
104
120
105
121
This example sets idle settings for a scheduled task.
106
122
@@ -110,16 +126,36 @@ The first command creates a scheduled task action named Cmd and assigns the **Sc
The second command creates scheduled task settings that specify that Task Scheduler runs the task only when a network is available. This command assigns the **ScheduledTaskSettings** object to the $Stset variable.
The first command creates a scheduled task action named Cmd and assigns the ScheduledTaskAction object to the $Sta variable.
135
+
136
+
The second command creates scheduled task settings that specify that Task Scheduler runs the task only when a network is available. This command assigns the **ScheduledTaskSettings** object to the $Stset variable.
137
+
138
+
The third command registers the scheduled task Task01 to run the task action named Cmd only when a network is available.
119
139
120
140
This example registers a scheduled task that runs only when a network is available.
121
141
122
-
The first command creates a scheduled task action named Cmd and assigns the **ScheduledTaskAction** object to the $Sta variable.
142
+
### Example 6: Register a scheduled task that has a time limit to complete the task
The first command creates a scheduled task action named Cmd and assigns the ScheduledTaskAction object to the $Sta variable.
152
+
153
+
The second command creates scheduled task settings that specify if the task is not finished after one hour, it is considered as failed. This command assigns the **ScheduledTaskSettings** object to the $Stset variable.
154
+
155
+
The third command registers the scheduled task Task01 to run the task action named Cmd, only then finish the task after one hour.
156
+
157
+
Without the ExecutionTimeLimit setting defined, the time limit set to it's default of three days for the Task Scheduler is allowed to complete the task. To configure the time limit, see [New-TimeSpan](https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/new-timespan).
0 commit comments