New-CMMachineConnection
Applies To: System Center 2012 Configuration Manager Support Center
New-CMMachineConnection
Creates a connection to a Configuration Manager client computer.
Syntax
Parameter Set: Local
New-CMMachineConnection [-PipelineVariable <String> ] [-Verify] [ <CommonParameters>]
Parameter Set: Remote
New-CMMachineConnection -MachineName <String> [-Password <SecureString> ] [-PipelineVariable <String> ] [-UserName <String> ] [-Verify] [ <CommonParameters>]
Detailed Description
The New-CMMachineConnection cmdlet creates a connection to a System Center 2012 Configuration Manager client computer. This connection allows you to gather a bundle of logs and other data from the client to provide to a support specialist.
You can connect to either a remote computer or the local computer. To connect to the local computer, do not specify the MachineName, Password, and UserName parameters. The cmdlet uses the credentials of the account that runs the cmdlet to connect to a local client computer.
Parameters
-MachineName<String>
Specifies the name of the remote Configuration Manager client computer to connect to.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Password<SecureString>
Specifies the password for the user account to use to establish a remote connection.
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 |
-UserName<String>
Specifies the user name for the user account to use to establish a remote connection.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Verify
Indicates that the cmdlet verifies that it created a connection.
Aliases |
none |
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: Create a connection for data collection
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 current 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 Get-CMDataCollectionTasks 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"