My command and the error I get are below. I've tried every combination of quotes, braces, and backticks I can think of. Does anyone know how to get this to work?
PS C:\Windows\system32> powershell.exe -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -InputFormat None -Command " & {(Get-WmiObject -Class win32_service -Filter "name='MSSQLSERVER'").StartName}"
Get-WmiObject : Invalid query "select * from win32_service where name=MSSQLSERVER" At line:1 char:6 + & {(Get-WmiObject -Class win32_service -Filter name=MSSQLSERVER).StartName} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ManagementException + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand