< Back

Register-MonConnection

Sat Jan 18, 2020 4:23 pm

NAME Register-MonConnection



SYNOPSIS

Registers logic that connects to targets.





SYNTAX

Register-MonConnection [-Capability] <String> [-ConnectionScript] <ScriptBlock> [[-DisconnectionScript]

<ScriptBlock>] [<CommonParameters>]





DESCRIPTION

Registers logic that connects to targets.

Use this to add capabilities to the module, that can then be used to connect to a target and be leveraged by

checks.





PARAMETERS

-Capability <String>

The name to assign to the capability.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ConnectionScript <ScriptBlock>

The script to connect to a target.

Only receives the name of the target as argument.

Must return a hashtable, either with a unique name and the connection object, or an empty hashtable.

The hashtable may contain more than one entry and will be merged with other entires, if a target supports

multiple capabilities.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-DisconnectionScript <ScriptBlock>

The script to disconnect from a target.

Receives two arguments:

- A hashtable of connections

- The name of the target

The hastable in question contains ALL connections from all capabilities applicable to the target.



Required? false

Position? 3

Default value { }

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Register-MonConnection -Capability 'WinRM' -ConnectionScript $connect -DisconnectionScript $disconnect



Registers the WinRM capability with logic to connect and logic to disconnect.











RELATED LINKS