I have installed dbatools on a central server to remotely manage SQL servers. All the servers are part of a workgroup. I need to be able to remotely restart the SQL Server service whenever it's required.

I attempted to use the following PowerShell script:

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

$Cred = New-Object System.Management.Automation.PSCredential ("Administrator", $password)

Restart-DbaService -ComputerName -Type Engine -Force -Credential $Cred

However, when I tried to execute this script, it resulted in an error message as follows: enter image description here

  • -ComputerName is not the name of the machine. Use the fully qualified domain name. And ensure WinRM is set up correctly. Commented Sep 8, 2023 at 13:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.