Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Import-DbaPfDataCollectorSetTemplate on GitHub.
Want to see the Bill Of Health for this command? Check out Import-DbaPfDataCollectorSetTemplate.
Imports a new Performance Monitor Data Collector Set Template either from the dbatools repository or a file you specify.
Imports a new Performance Monitor Data Collector Set Template either from the dbatools repository or a file you specify.
When importing data collector sets from the local instance, Run As Admin is required.
Note: The included counters will be added for all SQL instances on the machine by default.
For specific instances in addition to the default, use -Instance.
See https://msdn.microsoft.com/en-us/library/windows/desktop/aa371952 for more information
Import-DbaPfDataCollectorSetTemplate
[[-ComputerName] <DbaInstanceParameter[]>]
[[-Credential] <PSCredential>]
[[-DisplayName] <String>]
[-SchedulesEnabled]
[[-RootPath] <String>]
[-Segment]
[[-SegmentMaxDuration] <Int32>]
[[-SegmentMaxSize] <Int32>]
[[-Subdirectory] <String>]
[[-SubdirectoryFormat] <Int32>]
[[-SubdirectoryFormatPattern] <String>]
[[-Task] <String>]
[-TaskRunAsSelf]
[[-TaskArguments] <String>]
[[-TaskUserTextArguments] <String>]
[-StopOnCompletion]
[[-Path] <String[]>]
[[-Template] <String[]>]
[[-Instance] <String[]>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Import-DbaPfDataCollectorSetTemplate -ComputerName sql2017 -Template 'Long Running Query'
Creates a new data collector set named 'Long Running Query' from the dbatools repository on the SQL Server sql2017.
PS C:\> Import-DbaPfDataCollectorSetTemplate -ComputerName sql2017 -Template 'Long Running Query' -DisplayName 'New Long running query' -Confirm
Creates a new data collector set named "New Long Running Query" using the 'Long Running Query' template. Forces a confirmation if the template exists.
PS C:\> Get-DbaPfDataCollectorSet -ComputerName sql2017 -Session db_ola_health | Remove-DbaPfDataCollectorSet
Import-DbaPfDataCollectorSetTemplate -ComputerName sql2017 -Template db_ola_health | Start-DbaPfDataCollectorSet
Imports a session if it exists, then recreates it using a template.
PS C:\> Get-DbaPfDataCollectorSetTemplate | Out-GridView -PassThru | Import-DbaPfDataCollectorSetTemplate -ComputerName sql2017
Allows you to select a Session template then import to an instance named sql2017.
PS C:\> Import-DbaPfDataCollectorSetTemplate -ComputerName sql2017 -Template 'Long Running Query' -Instance SHAREPOINT
Creates a new data collector set named 'Long Running Query' from the dbatools repository on the SQL Server sql2017 for both the default and the SHAREPOINT instance.
If you'd like to remove counters for the default instance, use Remove-DbaPfDataCollectorCounter.
The target computer. Defaults to localhost.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value | $env:COMPUTERNAME |
Allows you to login to servers using alternative credentials. To use:
$scred = Get-Credential, then pass $scred object to the -Credential parameter.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Sets the display name of the data collector set.
Alias | |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, sets a value that indicates whether the schedules are enabled.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Sets the base path where the subdirectories are created.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Sets a value that indicates whether PLA creates new logs if the maximum size or segment duration is reached before the data collector set is stopped.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Sets the duration that the data collector set can run before it begins writing to new log files.
Alias | |
Required | False |
Pipeline | false |
Default Value | 0 |
Sets the maximum size of any log file in the data collector set.
Alias | |
Required | False |
Pipeline | false |
Default Value | 0 |
Sets a base subdirectory of the root path where the next instance of the data collector set will write its logs.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Sets flags that describe how to decorate the subdirectory name. PLA appends the decoration to the folder name. For example, if you specify plaMonthDayHour, PLA appends the current month, day, and
hour values to the folder name. If the folder name is MyFile, the result could be MyFile110816.
Alias | |
Required | False |
Pipeline | false |
Default Value | 3 |
Sets a format pattern to use when decorating the folder name. Default is 'yyyyMMdd-NNNNNN'.
Alias | |
Required | False |
Pipeline | false |
Default Value | yyyyMMdd-NNNNNN |
Sets the name of a Task Scheduler job to start each time the data collector set stops, including between segments.
Alias | |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, sets a value that determines whether the task runs as the data collector set user or as the user specified in the task.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Sets the command-line arguments to pass to the Task Scheduler job specified in the IDataCollectorSet::Task property.
See https://msdn.microsoft.com/en-us/library/windows/desktop/aa371992 for more information.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Sets the command-line arguments that are substituted for the substitution variable in the IDataCollectorSet::TaskArguments property.
See https://msdn.microsoft.com/en-us/library/windows/desktop/aa371993 for more information.
Alias | |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, sets a value that determines whether the data collector set stops when all the data collectors in the set are in a completed state.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
The path to the xml file or files.
Alias | FullName |
Required | False |
Pipeline | true (ByPropertyName) |
Default Value |
From one or more of the templates from the dbatools repository. Press Tab to cycle through the available options.
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default, the template will be applied to all instances. If you want to set specific ones in addition to the default, supply just the instance name.
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |