$conn = Get-CrmConnection -InteractiveMode

$conn.BypassPluginExecution = $true
$crmConnection = Get-CrmConnection -InteractiveMode

$crmConnection.BypassPluginExecution = $true

# Define CRM connection details
$crmUrl = "https://allam.crm8.dynamics.com/"
$accessToken = $crmConnection.CurrentAccessToken
$headers = @{
    "Authorization" = "Bearer $accessToken"
    "OData-MaxVersion" = "4.0"
    "OData-Version" = "4.0"
    "Accept" = "application/json"
    "Content-Type" = "application/json; charset=utf-8"
}

# Specify the unique identifier (GUID) of the plugin step you want to disable
$pluginStepId = "63b5066c-cecf-ee11-904d-6045bdad183f"

# Construct the URL to update the plugin step's status
$pluginStepUrl = "$crmUrl/api/data/v9.0/sdkmessageprocessingsteps($pluginStepId)"

# Define the payload to update the plugin step's status to disabled
$statusUpdatePayload = @{
    statecode = 1 # Set state code to 'Disabled'
    statuscode = 2 # Set status code to 'Disabled'
} | ConvertTo-Json

# Send HTTP PATCH request to update the plugin step's status
Invoke-RestMethod -Uri $pluginStepUrl -Headers $headers -Method Patch -Body $statusUpdatePayload

Open maker

$crmConnection = Get-CrmConnection -InteractiveMode

$crmConnection.BypassPluginExecution = $true

# Define CRM connection details
$crmUrl = "https://allam.crm8.dynamics.com/"
$accessToken = $crmConnection.CurrentAccessToken
$headers = @{
    "Authorization" = "Bearer $accessToken"
    "OData-MaxVersion" = "4.0"
    "OData-Version" = "4.0"
    "Accept" = "application/json"
    "Content-Type" = "application/json; charset=utf-8"
}

# Specify the unique identifier (GUID) of the plugin step you want to disable
$pluginStepId = "63b5066c-cecf-ee11-904d-6045bdad183f"

# Construct the URL to update the plugin step's status
$pluginStepUrl = "$crmUrl/api/data/v9.0/sdkmessageprocessingsteps($pluginStepId)"

# Define the payload to update the plugin step's status to disabled
$statusUpdatePayload = @{
    statecode = 0  # Set state code to enabled
    statuscode = 1 # Set status code to enabled
} | ConvertTo-Json

# Send HTTP PATCH request to update the plugin step's status
Invoke-RestMethod -Uri $pluginStepUrl -Headers $headers -Method Patch -Body $statusUpdatePayload

HTTP PATCH