$plugins = Get-CrmPlugin -Connection $crmConnection
$pluginToDisable = $plugins | Where-Object { $_.Name -eq "AccountAsyncPlugin" }
# Check if the plugin was found if ($pluginToDisable) { # Disable the plugin Disable-CrmPlugin -Connection $crmConnection -Id $pluginToDisable.Id Write-Host "Plugin 'MyPlugin' has been disabled." } else { Write-Host "Plugin 'MyPlugin' not found." }