DisableACMEProxyRedirect - RIT-ITS/CertifiCat-PS GitHub Wiki

Synopsis

Disables the URL Rewrite Rule created by the Initialize-ACMEProxyRedirect function on either the current server, or a remote server.

Syntax

Disable-ACMEProxyRedirect  [-TargetServer<String>] 
    [-IISSiteName <String>>] [-URLRewriteRuleName <String>] 
    [-debugEnabled] [-debugLogDirectory <string>] [-debugMode <string>]

Description

This function will disable the IIS URL Rewrite Rule created by the Initialize-ACMEProxyRedirect function. By default, it assumes the rule to have been named “ACME Challenge Proxy,” however, this can be overridden. The function can be used either to enable the rule on the current server, or on an alternate server (as a means of eliminating the need to wrap the function in an Invoke-Command block).

⚠️ Warning: This function cannot be run on versions of PowerShell above 6 at this time. For more information, see the PowerShell Requirements section in the System Requirements page.

If the function detects that it is being used in a PowerShell 7+ console, it will suspend, and output a command that can be run in a legacy PowerShell console instead.

Examples

Example 1: Disable the Rewrite Rule on the Current Server

Disable-ACMEProxyRedirect

This command will disable the URL Rewrite rule called “ACME Challenge Proxy” in the “Default Web Site” site on the current server.

Example 2: Disable the Rewrite Rule on an Alternate Server

Disable-ACMEProxyRedirect -TargetServer appB.example.com

This command will disable the URL Rewrite rule called “ACME Challenge Proxy” in the “Default Web Site” site on the server appB.example.com.

Example 3: Disable the Rewrite Rule in an Alternate Site with a Different Name

Disable-ACMEProxyRedirect URLRewriteRuleName "ACME" -iisSiteName "My App"

This command will disable the URL Rewrite rule called “ACME” in the website “My App” on the current server. Note that the virtual root (or application) must still be called .well-known, but the -iisSiteParameter allows this to have been moved to an alternate web site in IIS.

Parameters

-TargetServer

The name of an alternate server on which to disable the URL Rewrite Rule. When this parameter is omitted, the function runs on the current server.

Type: String
Position: Named
Default Value:  False
Required: False

-IISSiteName

The IIS Website in which the .well-known virtual directory containing the URL Rewrite Rule exists.

Type: String
Position: Named
Default Value:  Default Web Site
Required: False

-URLRewriteRuleName

The name of the URL Rewrite Rule that was created by the Initialize-ACMEProxyRedirect command.

Type: String
Position: Named
Default Value:  ACME Challenge Proxy
Required: False

-debugEnabled

This switch must be present to cause the function in question to output the contents of the object to a file or event log

Type: Switch
Position: Named
Required: False

-debugLogDirectory

Specifies where the CertifiCat-PS debug logs are written, when the debugMode option is EVT or Both.

Type: String
Position: Named
Required: False

-debugMode

Controls where the CertifiCat-PS debug informaiton is written: EVT (the windows event log), File (a text file on disk), or Both (a text file on disk and the Windows Event Log)

Type: String
Position: Named
Required: False
Default Value: EVT
ValidateSet: EVT, File, Both

Outputs

Returns a custom PowerShell object with properties about the function and the account that was set up. The object has the following properties:

Property Details
FunctionName Name of the function that was run
RunningPSVersion The version of the PowerShell console used to run the function
PS5Command A full string containing the commands needed to run the same command in PowerShell 5
FunctionArguments A list of the arguments passed to the function
FunctionSuccess True/False indicating if the function succeeded. When false, this typically indicates a larger issue (e.g. no admin rights, etc)
Errors A string containing details about any errors that were encountered
URLRewriteRuleName The name of the URL Rewrite Module used for the ACNE Proxy Redirect
AffectedServer The name of the server on which the rule was enabled (as specified by the -TargetServer parameter). In the case of the parameter being omitted (and the script run in the context of the current server), this property is null.
DisabledSuccessfully True/False indicating whether or not the URL Rewrite rule was disabled successfully.
URLRewriteRuleFound True/False indicating whether or not the URL Rewrite rule was found on the target server.
RemoteConnectionOK Boolean indicating whether or not a remote connection could be made to the target computer
debugEnabled Boolean indicating whether debug logging was enabled
debugLogDirectory String indicating the location of the debug log file, if file logging mode is enabled
debugMode String indicating the logging mode (i.e. EVT, File, or Both)

Related Links

⚠️ **GitHub.com Fallback** ⚠️