-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_template.ps1
More file actions
85 lines (72 loc) · 2.54 KB
/
_template.ps1
File metadata and controls
85 lines (72 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<#
.SYNOPSIS
Short description.
.DESCRIPTION
Long description.
.PARAMETER Drive
Pre-defined drive name to use.
.INPUTS
Drive letter or drive label. You can pipe drive letters or drive labels as System.String.
.OUTPUTS
None.
.EXAMPLE
PS> .\script.ps1 -Drive Music1,Music4
#>
using module Varan.PowerShell.Music
using module Varan.PowerShell.PerformanceTimer
using module Varan.PowerShell.SelfElevate
using module Varan.PowerShell.Summary
using module Varan.PowerShell.Validation
# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#Requires -Version 5.0
#Requires -Modules Varan.PowerShell.Base
#Requires -Modules Varan.PowerShell.Common
#Requires -Modules Varan.PowerShell.Music
#Requires -Modules Varan.PowerShell.PerformanceTimer
#Requires -Modules Varan.PowerShell.SelfElevate
#Requires -Modules Varan.PowerShell.Summary
#Requires -Modules Varan.PowerShell.Validation
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
param (
)
DynamicParam { Build-BaseParameters -IncludeMusicPathQueues }
Begin
{
Write-LogTrace "Execute: $(Get-RootScriptName)"
$minParams = Get-MinimumRequiredParameterCount -CommandInfo (Get-Command $MyInvocation.MyCommand.Name)
$cmd = @{}
if(Get-BaseParamHelpFull) { $cmd.HelpFull = $true }
if((Get-BaseParamHelpDetail) -Or ($PSBoundParameters.Count -lt $minParams)) { $cmd.HelpDetail = $true }
if(Get-BaseParamHelpSynopsis) { $cmd.HelpSynopsis = $true }
if($cmd.Count -gt 1) { Write-DisplayHelp -Name "$(Get-RootScriptPath)" -HelpDetail }
if($cmd.Count -eq 1) { Write-DisplayHelp -Name "$(Get-RootScriptPath)" @cmd }
}
Process
{
try
{
$isDebug = Assert-Debug
if ($PSBoundParameters["IncludeMusicPathQueuesParameter"]) {
if(-Not (Assert-PathQueueParameter))
{
Write-DisplayHelp -Name "$(Get-RootScriptPath)" -HelpDetail
}
$queue = Get-PathQueue -DrivePreset (Get-BaseParamDrivePreset) -DriveLetter (Get-BaseParamDriveLetter) -DriveLabel (Get-BaseParamDriveLabel) -Path (Get-BaseParamPath)
foreach($q in $queue)
{
if($q.BackupPath.Length -eq 0) { continue }
# main code using path queue
}
}
# rest of main code
}
catch [System.Exception]
{
Write-DisplayError $PSItem.ToString() -Exit
}
}
End
{
Write-DisplayHost "Done." -Style Done
}
# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------