Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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= localhost\MY_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= computername\MY_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 localhost\username instead of computername\username?

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.

share|improve this question
    
looking now - I am not certain it was ever working before –  Adam Butler Apr 7 '11 at 15:05
add comment

1 Answer 1

up vote 2 down vote accepted

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

%COMPUTERNAME%\MY_SERVUSER

as the username.

share|improve this answer
1  
.\MY_SERVUSER might also work. –  William Jackson Apr 7 '11 at 14:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.