Set-FilesConnection

Makes a connection the default of the current runspace, or clears the default.

Syntax

Connection (Default)

Set-FilesConnection [-Connection] <FilesConnection> [-PassThru]

Clear

Set-FilesConnection -Clear

Description

Set-FilesConnection chooses the connection FilesCom commands use in the current runspace when they are not given -Connection. The choice is local to the runspace and is never saved. With -Clear, commands need -Connection until a default is set again; the connection itself stays open.

Examples

Example 1: Switch the default connection

Set-FilesConnection -Connection $staging

Commands in this runspace now use the staging connection by default.

Example 2: Require an explicit connection

Set-FilesConnection -Clear

Commands fail with Files.NoConnection unless given -Connection.

Parameters

-Clear

Clears the default, so commands need -Connection. The connection itself stays open.

  • Type: System.Management.Automation.SwitchParameter
  • Parameter sets: Clear (required)

-Connection

The connection to make the default. It must be open.

  • Type: FilesCom.PowerShell.FilesConnection
  • Parameter sets: Connection (required, position 0, pipeline input)

-PassThru

Writes the new default connection.

  • Type: System.Management.Automation.SwitchParameter
  • Parameter sets: Connection

Common Parameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

  • FilesCom.PowerShell.FilesConnection: The connection to make the default.

Outputs

  • None: Nothing, unless -PassThru is given.
  • FilesCom.PowerShell.FilesConnection: With -PassThru, the new default connection.

Notes

Setting the default changes nothing on Files.com. See about_FilesCom for connections, errors and previewing changes.

  • Get-Help about_FilesCom