0

I am trying to uninstall outdated crowdstrike using CsUninstallTool.exe on bunch of remote servers.

As we know we cannot directly uninstall crowdstrike, it require a maintenance code unique to host. The below script is working correctly for a single remote host but when I try to run same script, crowdstrike did not get uninstalled.

Also same script is asking for credentials after every loop and looking for optimal way to manage user session without asking cred again & again.

$servers = Get-Content 'C:\Users\PP\Desktop\CrowdStrike_Automation\servers.txt'
$maintenance_token = Get-Content 'C:\Users\PP\Desktop\CrowdStrike_Automation\maintenance_key.txt'

foreach ($server in $servers) {
 
    Invoke-Command -ComputerName $server -Credential (Get-Credential) -ScriptBlock {
        & "C:\Temp\CrowdStrike_Automation\Setup\CsUninstallTool.exe" MAINTENANCE_TOKEN=$using:maintenance_token /quiet
    }
}

Any suggestion?

1
  • $c = get-credential and invoke-command $servers -cr $c If the uninstaller runs in the background, you might have to wait for it or use a pssession.
    – js2010
    Jan 25 at 14:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.