Get-CMDataCollectionTasks
Applies To: System Center 2012 Configuration Manager Support Center
Get-CMDataCollectionTasks
Gets the data collection tasks that apply to a Configuration Manager client computer.
Syntax
Parameter Set: Default
Get-CMDataCollectionTasks [-MatchName <String[]> ] [-PipelineVariable <String> ] [ <CommonParameters>]
Detailed Description
The Get-CMDataCollectionTasks cmdlet gets the data collection tasks that apply to a System Center 2012 Configuration Manager client computer.
Parameters
-MatchName<String[]>
Specifies an array of strings to match. The cmdlet gets data collection tasks that have names that include one or more strings in the array. For example, if you specify the string "client" for this parameter, the cmdlet gets each data collection task that contains the string "client" in its task name.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PipelineVariable<String>
Specifies a variable to use with the pipeline operator.
Aliases |
pv |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Examples
Example 1: Get data collection tasks
This example establishes a remote connection to a Configuration Manager client, gets data collection tasks, and starts data collection.
The first command uses the ConvertTo-SecureString cmdlet to create a secure string based on the specified password, and then stores that string in the $Password variable. For more information, type Get-Help ConvertTo-SecureString
.
The second command uses the New-CMMachineConnection cmdlet to create a connection to a remote computer by using the specified user name and the password stored in the $Password variable. The command verifies that it creates the connection.
The third command uses the current cmdlet to get data collection tasks, and stores them in the $Tasks variable.
The final command uses the Invoke-CMDataCollection cmdlet to start data collection of the tasks stored in $Tasks. The command specifies an output file.
PS C:\> $Password = ConvertTo-SecureString -AsPlainText -String "Password123" -Force
PS C:\> $Connection = New-CMMachineConnection -MachineName "Client01.corp.contoso.com" -UserName "CONTOSO\PattiFuller" -Password $Password -Verify
PS C:\> $Tasks = Get-CMDataCollectionTasks
PS C:\> Invoke-CMDataCollection -MachineConnection $Connection -CollectionTasks $Tasks -OutputFile "C:\DataCollection\Client01Data"