Forum Discussion
PowerShell script
- Jun 21, 2021
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
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