Disconnect-FilesAccount
Closes a connection, revoking the session it owns.
Syntax
__AllParameterSets
Description
Disconnect-FilesAccount closes a connection. Operations still running with it are cancelled, and commands given it afterward fail with Files.ConnectionClosed. The command returns once the engine has finished with what those operations were using, such as their requests, responses and temporary files, and has closed the network connections it made for the connection. It does not wait for each running command to end: each command ends on its own, usually with Files.Cancelled, though one whose response had already arrived can still succeed, and an upload whose final request had been sent may have completed the file. A stream a command borrowed stays open and its caller's. Stopping Disconnect-FilesAccount, as with Ctrl+C, stops only its wait. A -HttpMessageHandler the connection borrowed is never disposed. Objects fetched with it stay usable as data.
A connection made by signing in with -Credential owns its session, and Disconnect-FilesAccount revokes that session on Files.com before closing the connection. If revoking fails, the connection is still closed locally and the command writes a separate error saying the session may remain valid until it expires. API keys and session IDs you supplied are never revoked.
Removing the FilesCom.PowerShell module closes the connections of the runspace that removes it, locally, without revoking any session.
Examples
Example 1: Close the default connection
Closes the runspace's default connection and revokes its session if the connection signed in.
Example 2: Close a connection but keep its session
Closes the connection locally; the session it created stays valid until it expires.
Example 3: Preview disconnecting
Describes which connections would be closed and which sessions revoked.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
- Type:
System.Management.Automation.SwitchParameter - Parameter sets:
(All) - Aliases:
cf
-Connection
The connection to close. Defaults to the current runspace's default connection.
- Type:
FilesCom.PowerShell.FilesConnection - Parameter sets:
(All)(position 0, pipeline input)
-KeepSession
Closes the connection without revoking a session it created, which then stays valid until it expires.
- Type:
System.Management.Automation.SwitchParameter - Parameter sets:
(All)
-PassThru
Writes the closed connection.
- Type:
System.Management.Automation.SwitchParameter - Parameter sets:
(All)
-WhatIf
Runs the command in a mode that only reports what would happen without performing the actions.
- Type:
System.Management.Automation.SwitchParameter - Parameter sets:
(All) - Aliases:
wi
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: A connection to close.
Outputs
- None: Nothing, unless -PassThru is given.
FilesCom.PowerShell.FilesConnection: With -PassThru, the closed connection.
Notes
Revoking an owned session is a request to Files.com and supports -WhatIf and -Confirm like any other change. See about_FilesCom for connections, errors and previewing changes.
Related Links
Get-Help about_FilesCom