Search connection strings from command line

The following example shows a sample configuration signature used to search connection strings from command line.

 <CommandLine>
    <Regex expr="\s*(\S+)=\s*(\S+).*">
        <Variable name="name" group="1"/>
        <Variable name="value" group="2"/>
    </Regex>
    <SystemVariable name="oracle_home" environmentName="ORACLE_HOME"/>
    <SystemVariable name="tns_home" environmentName="TNS_ADMIN"/>
    <Execute cmdline="%windir%\system32\inetsrv\appcmd.exe" os="win">
        <Regex expr='\s+(\S+${scp.type}/(\*|${scp.ip}):${scp.port}\S+)'>
            <Variable name="siteName" group="1"/>
        </Regex>
    </Execute>
</CommandLine>

In this example, the <CommandLine> element is used to define rules to search connection strings from command lines or system variables. It can contain the following elements:

  • <Regex>: extract connection strings by using a regular expression.
  • <SystemVariable>: get values from the system environment variables.
  • <Execute>: execute a shell command on the remote machine, and then use a regular expression to get connection strings.