PowerShell script

Copper Contributor

Hi All,  Good day. I have 100 windows servers in AWS cloud. I want to check a windows service called "xxxxx" (eg.) running or exists. If exists or running, then it should be disabled. Servers list can be given input as csv file in the script. Could any one suggest PowerShell script to achieve this?

1 Reply
best response confirmed by Chandra318 (Copper Contributor)



Hi Chandra, 


$password = ConvertTo-SecureString "password_here" -AsPlainText -Force

$cred = New-Object System.Management.Automation.PSCredential ("username_here", $password )

Invoke-Command -ComputerName remoteservername -Credential $cred -ScriptBlock {Stop-Service -Name "your_service_name"|Set-Service -Name "your_service_name" -Status stopped -StartupType disabled


You can read your csv and write each line on a $var and change on remoteservername