Verified issue does not already exist?
Yes
What error did you receive?
No errors. TargetFile and TargetFileMetadataPath parameters are ignored unless the template imported has specific properties defined.
Steps to Reproduce
Import-DbaXESessionTemplate -SqlInstance barfoo -Template 'Connection Detail Tracking' -EnableException -Name foobar -TargetFilePath foobar
It works successfully and the session with name foobar is created. Parameter TargetFilePath is ignored, as there is no event_file target at all. This is at least misleading. As neither help for the paramater, nor any logging says anything about it.
Are you running the latest release?
Yes
Other details or mentions
It is quite clear why from those lines:
https://github.com/sqlcollaborative/dbatools/blob/development/functions/Import-DbaXESessionTemplate.ps1#L161-L168
I would propose to create target file if it is not in the template.
Xml is imported on line 172. Replacing strings in the xml could be improved by properly modifying xml.
What PowerShell host was used when producing this error
Windows PowerShell (powershell.exe)
PowerShell Host Version
Name Value
PSVersion 5.1.18362.1593
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.1593
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
SQL Server Edition and Build number
Microsoft SQL Server 2016 (SP2-CU10) (KB4524334) - 13.0.5492.2 (X64) Oct 4 2019 19:14:08 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows Server 2016 Standard 10.0 (Build 14393: ) (Hypervisor)
Verified issue does not already exist?
Yes
What error did you receive?
No errors. TargetFile and TargetFileMetadataPath parameters are ignored unless the template imported has specific properties defined.
Steps to Reproduce
It works successfully and the session with name foobar is created. Parameter TargetFilePath is ignored, as there is no event_file target at all. This is at least misleading. As neither help for the paramater, nor any logging says anything about it.
Are you running the latest release?
Yes
Other details or mentions
It is quite clear why from those lines:
https://github.com/sqlcollaborative/dbatools/blob/development/functions/Import-DbaXESessionTemplate.ps1#L161-L168
I would propose to create target file if it is not in the template.
Xml is imported on line 172. Replacing strings in the xml could be improved by properly modifying xml.
What PowerShell host was used when producing this error
Windows PowerShell (powershell.exe)
PowerShell Host Version
Name Value
PSVersion 5.1.18362.1593
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.1593
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
SQL Server Edition and Build number
Microsoft SQL Server 2016 (SP2-CU10) (KB4524334) - 13.0.5492.2 (X64) Oct 4 2019 19:14:08 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows Server 2016 Standard 10.0 (Build 14393: ) (Hypervisor)