Created
October 16, 2020 18:11
-
-
Save joanbono/40669f190e27b0d46f669713229e557d to your computer and use it in GitHub Desktop.
Start/Stop Checkmarx Services in Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.DESCRIPTION | |
Starts/Stops Checkmarx and IIS services | |
.REQUIRES | |
Checkmarx and IIS (Tested with Checkmarx 9.2) | |
.NOTES | |
Name: Checkill.ps1 | |
Author: Joan Bono <@joan_bono> | |
Tested on Powershell v5.1 | |
Version: 1.0.0 | |
.EXAMPLE | |
.\Checkill.ps1 (-Start|-Stop) | |
#> | |
Param ( | |
[switch]$Start = $false, | |
[switch]$Stop = $false | |
) | |
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) | |
If ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -eq $false) { | |
Write-Host -ForegroundColor red -NoNewline "`n❎ ERROR:" | |
Write-Host " Run the script as Administrator `n" | |
exit 0 | |
} | |
If ($Stop -eq $Start){ | |
Write-Host -ForegroundColor red -NoNewline "`n⚠ ERROR:" | |
Write-Host " Start and Stop have the same value" | |
Write-Host -BackgroundColor Blue -NoNewline "ℹ" | |
Write-Host -NoNewLine " USAGE: .\Checkill.ps1 (-Start|-Stop) `n" | |
exit 0 | |
} | |
If ($Start -eq $true){ | |
Write-Host -BackgroundColor Blue -NoNewline "ℹ" | |
Write-Host -NoNewLine " Starting " | |
Write-Host -ForegroundColor Green -NoNewLine "✅Checkmarx" | |
Write-Host " and IIS Service" | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Starting CxARM" | |
Start-Service -Name "CxARM" | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Starting CxARMETL" | |
Start-Service -Name "CxARMETL" | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Starting CxJobsManager" | |
Start-Service -Name "CxJobsManager" | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Starting CxRemediationIntelligence" | |
Start-Service -Name "CxRemediationIntelligence" | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Starting CxSastResults" | |
Start-Service -Name "CxSastResults" | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Starting CxScanEngine" | |
Start-Service -Name "CxScanEngine" | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Starting CxScansManager" | |
Start-Service -Name "CxScansManager" | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Starting CxSystemManager" | |
Start-Service -Name "CxSystemManager" | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Starting IISAdmin" | |
Start-Service -Name "iisadmin" | |
} ElseIf ($Stop -eq $true){ | |
Write-Host -BackgroundColor Blue -NoNewline "ℹ" | |
Write-Host -NoNewLine " Stopping " | |
Write-Host -ForegroundColor Green -NoNewLine "✅Checkmarx" | |
Write-Host " and IIS Service" | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Stopping CxARM" | |
Stop-Service -Name "CxARM" -Force -NoWait | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Stopping CxARMETL" | |
Stop-Service -Name "CxARMETL" -Force -NoWait | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Stopping CxJobsManager" | |
Stop-Service -Name "CxJobsManager" -Force -NoWait | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Stopping CxRemediationIntelligence" | |
Stop-Service -Name "CxRemediationIntelligence" -Force -NoWait | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Stopping CxSastResults" | |
Stop-Service -Name "CxSastResults" -Force -NoWait | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Stopping CxScanEngine" | |
Stop-Service -Name "CxScanEngine" -Force -NoWait | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Stopping CxScansManager" | |
Stop-Service -Name "CxScansManager" -Force -NoWait | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Stopping CxSystemManager" | |
Stop-Service -Name "CxSystemManager" -Force -NoWait | |
Write-Host -ForegroundColor Yellow -NoNewline "⚠" | |
Write-Host " Stopping IISAdmin" | |
Stop-Service -Name "iisadmin" -Force -NoWait | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment