34 lines
1.3 KiB
PowerShell
34 lines
1.3 KiB
PowerShell
Param(
|
|
[string]
|
|
$Name,
|
|
|
|
[ValidateSet(
|
|
'Infra-ActiveDirectory.Object',
|
|
'Infra-Azure.VirtualMachine',
|
|
'Infra-Monitoring-Solarwinds',
|
|
'Infra-VMware.Administration',
|
|
'Infra-VMware.VirtualMachine',
|
|
'Infra-VMware.Snapshot',
|
|
'ITD-WindowsServer.FileManagement',
|
|
'ITD-WindowsServer.General',
|
|
'ITD-WindowsServer.Lifecycle',
|
|
'Shared-Powerschool'
|
|
)]
|
|
[string]
|
|
$Path
|
|
)
|
|
|
|
switch ($Path){
|
|
<# example switch condition and actions
|
|
{ $_ -like "App-XXXXX"} {$TagNamesEnforced = @('Shared-XXXXX_Modify)}
|
|
#>
|
|
{ $_ -eq "Infra-ActiveDirectory.Object" } { $TagNamesEnforced = @('ITD-WindowsServer_Modify') }
|
|
{ $_ -like "Infra-Azure.*"} {$TagNamesEnforced = @('Infra-VMware_Modify')}
|
|
{ $_ -like "Infra-Monitoring-Solarwinds*" } { $TagNamesEnforced = @('ITD-WindowsServer_Modify') }
|
|
{ $_ -like "Infra-VMware*" } { $TagNamesEnforced = @('Infra-VMware_Modify') }
|
|
{ $_ -like "ITD-WindowsServer*" } { $TagNamesEnforced = @('ITD-WindowsServer_Modify') }
|
|
{ $_ -like "Shared-PowerSchool*" } { $TagNamesEnforced = @('Shared-PowerSchool_Modify') }
|
|
|
|
}
|
|
New-PSUScript -Name $Name -Path "$Path\$Name" -Tag @($TagNamesEnforced) -ScriptBlock {# It all starts with a single line of powershell code.
|
|
} |