I have a Powershell script called MSSQLStartStopServices.ps1 used to stop some SQL Server services. This script is being called using a third-party vendor software. The parameters in question are Fully qualified instance name and Start|Stop
e.g.
MSSQLStartStopServices.ps1 HOSTNAME\INSTANCENAME Start
For a default instance, the software passes (local) as the INSTANCENAME.
MSSQLStartStopServices.ps1 HOSTNAME\(local) Start
But when I run this I get an error from Powershell:
The term 'local' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
When I try and put the instance name in quotes it works fine in a Powershell window:
MSSQLStartStopServices.ps1 "HOSTNAME\(local)" Start
However the third party software calls Powershell from the commandline first, like so:
powershell .\MSSQLStartStopServices.ps1 "HOSTNAME\(local)" Start
This causes the same error as if the quotes were not there.
How do I work around this issue?
".\MSSQLStartStopServices.ps1 'HOSTNAME(local)' Start