This is a bit of an odd one, but I am trying to figure out how to use sc.exe with variable parameters.  Powershell 7.X does not support Set-Service password changes for remote services.  However, you can still do so via sc.exe <server> <servicename> obj= "domain\username" password= "whatever".
I am working this into an interactive script, so the remote server, service name, and username will already be in Powershell parameters.  However, doing something such as sc.exe \\$server $service obj= "$domain\$username" password= "whatever" does not work.  It fails with an unrecognized command error.
I assume this can be done and I am just missing something easy, but any help is appreciated.