Skip to content

Commit fddf22d

Browse files
committed
Remove use of $PSBoundParameters
1 parent c1319f2 commit fddf22d

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/ScheduledTaskManagement/Public/Setup-ScheduledTask.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,31 @@ function Setup-ScheduledTask {
2222
try {
2323
# Import definitions as an array of hashtable definitions
2424
$DefinitionsCollection = New-Object System.Collections.ArrayList
25-
if ($PSBoundParameters['DefinitionFile']) {
26-
$DefinitionFileCollection = Get-Item $PSBoundParameters['DefinitionFile']
27-
}elseif ($PSBoundParameters['DefinitionDirectory']) {
28-
$DefinitionFileCollection = if ($PSBoundParameters['AsJson']) {
29-
Get-ChildItem $PSBoundParameters['DefinitionDirectory'] -File | ? { $_.Extension -eq '.json' }
25+
if ($DefinitionFile) {
26+
$DefinitionFileCollection = Get-Item $DefinitionFile
27+
}elseif ($DefinitionDirectory) {
28+
$DefinitionFileCollection = if ($AsJson) {
29+
Get-ChildItem $DefinitionDirectory -File | ? { $_.Extension -eq '.json' }
3030
}else {
31-
Get-ChildItem $PSBoundParameters['DefinitionDirectory'] -File | ? { $_.Extension -eq '.ps1' }
31+
Get-ChildItem $DefinitionDirectory -File | ? { $_.Extension -eq '.ps1' }
3232
}
3333
}
34-
if (!$PSBoundParameters['DefinitionObject']) {
34+
if (!$DefinitionObject) {
3535
if (!$DefinitionFileCollection) {
3636
"No definitions could be found from the specified definition files or directories." | Write-Error
3737
return
3838
}
3939
}
40-
if (!$PSBoundParameters['DefinitionObject']) {
40+
if (!$DefinitionObject) {
4141
$DefinitionCollectionRaw = $DefinitionFileCollection | % {
42-
if ($PSBoundParameters['AsJson']) {
42+
if ($AsJson) {
4343
Get-Content -Path $_.FullName | ConvertFrom-Json
4444
}else {
4545
. $_.FullName
4646
}
4747
}
48-
}elseif ($PSBoundParameters['DefinitionObject']) {
49-
$DefinitionCollectionRaw = $PSBoundParameters['DefinitionObject']
48+
}elseif ($DefinitionObject) {
49+
$DefinitionCollectionRaw = $DefinitionObject
5050
}
5151
$DefinitionCollectionRaw | % {
5252
$definitionHashtable = if ($_.GetType() -ne [hashtable]) { $_ | ConvertTo-Hashtable } else { $_ }

0 commit comments

Comments
 (0)