Can Windows 7 service control command recognise username with localhost domain?

Posted on


I have set up a new user called MY_SERVUSER on a Windows 7 via computer management on a computer that is not on a domain. I have a script that sets up our service to start as that user that used to work under previous windows but now doesn’t.

The script calls something like:

sc config ConverterService start= auto obj= localhostMY_SERVUSER password= password

Which gets this error:

The account name is invalid or does
not exist, or the password is invalid
for the account name specified.

But if I run it like this it works:

sc config ConverterService start= auto obj= computernameMY_SERVUSER password= password

The computer is not on a domain. My guess is that in Windows 7 there is some sort of domain even if we are not on a domain. Is this correct? Is there anything that can be done to allow my scripts to continue using localhostusername instead of computernameusername?

If I need some other way to create the user that is fine but the same sc command must be able to run on multiple computers.


Windows batch files have access to the current computer name as %COMPUTERNAME% so you can just use


as the username.