We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e77bc15 commit 9f50c6fCopy full SHA for 9f50c6f
functions/Remove-DbaAgentJob.ps1
@@ -70,20 +70,20 @@ Removes the job from multiple servers using pipe line
70
[Parameter(Mandatory = $false)]
71
[int]$JobID,
72
73
- [ValidateScript( {
74
- if (-not($JobID) -and (-not($_))) {
75
- Throw "Please enter a job id or job name."
76
- }
77
- else {
78
- $true
79
80
- })]
81
[string]$JobName,
82
[switch]$KeepHistory,
83
[switch]$KeepUnusedSchedule,
84
[switch]$Silent
85
)
86
+ begin{
+ # Check if the job id or jobname are set
+ if (-not($JobID) -and (-not($JobName))) {
+ Stop-Function -Message "Please enter a job id or job name." -Target $instance
+ return
+ }
+
87
process {
88
89
foreach ($instance in $sqlinstance) {
0 commit comments