-
-
Notifications
You must be signed in to change notification settings - Fork 859
Closed
Description
Before submitting a bug report:
- Ensure you are able to reproduce it on the latest released version (we release often)
- Verified this bug is not already reported in an issue
- Verified errors are not related to permissions
- Can reproduce in a clean PowerShell session (clean =
powershell -NoProfile)
If two or more templates are imported, they can't get the same name. In this case the warning should be shown.
if (($Path.Count -gt 1 -or $Template.Count -gt 1) -and (Test-Bound -ParameterName Template)) {
Stop-Function -Message "Name cannot be specified with multiple files or templates because the Session will already exist."
}
So the second part should be Test-Bound -ParameterName Name
The function continues anyway when the warning is shown. For me it makes more sense if the function just stops after the warning instead of just doing the job partly.
Steps to Reproduce
Case 1:
Import-DbaXESessionTemplate -SqlInstance . -Template 'Database Health 2016 and Above','Activity Tracking'
Case 2:
Import-DbaXESessionTemplate -SqlInstance . -Template 'Database Health 2016 and Above','Activity Tracking' -Name test
## Expected Behavior
The first case should not show the warning. The second case should show the warning:
"Name cannot be specified with multiple files or templates because the Session will already exist."
## Actual Behavior
The first case shows the warning and the second case not.
## Environmental data
<!-- Provide output of the following two commands -->
- PowerShell:
Name Value
---- -----
PSVersion 5.1.14393.2636
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2636
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
- - SQL Server:
Microsoft SQL Server vNext (CTP2.0) - 15.0.1000.34 (X64) Sep 18 2018 10:18:13 Copyright (C) 2018 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor) Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels