Set Service Login for Windows Service - Thea Burger's Blog

Thea Burger's Blog

Wouldn't you like to know...

News

Photo's!!!

About me

I'm Reading: General Blogs

I'm Reading: Technical Blogs

Set Service Login for Windows Service

I was busy setting up a windows service when I got to the 'Set Service Login' dialog box. I entered the details of the local account that I created to run as a service and received the following error: “System.ComponentModel.Win32Exception: The account name is invalid or does not exist, or the password is invalid for the account name specified

Very simple error I made, but maybe it can help someone else :)
If you created a network account, in the Username field, you have to enter the domain name and the username using the format \. If you created a local account, in the Username field, enter the computer name and the username using the format \.

Comments

Colin said:

I don't know if you are using an installer project for installing it. If you are, be warned that it's not very robust.
1. When you run the installer, the Set Service Login box does not open modally with the installation wizard window as it's owner. Users sit and stare at the progressbar for hours, because it doesn't show in the taskbar. It's really funny the first time.
2. If you get the login wrong and it doesn't install correctly, the uninstall doesn't work. "The service does not exist" error.
3. Conversely if you want to install it and it is already there, "The service already exists" error.

So it's a good idea to have a bat file to install and uninstall the service using C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\InstallUtil.exe [/u] <pathtofile>\MyService.exe
# May 17, 2004 4:07 PM

Thea Burger said:

I am using installutil to install and uninstall, but thanks for the info. I didn't know this.
# May 17, 2004 4:18 PM

Didier said:

Thanks for this info, you saved me a lot of time!
# May 26, 2004 7:30 PM

Thea Burger said:

It is really good to see that some posts are useful!! :)
# May 27, 2004 9:11 AM

Asif Aziz said:

Change the Account for the serviceProcessInstaller to LocalSystem. It can be done by opening ProjectInstaller design and selecting serviceProcessInstaller, properties and change the account property to LocalSystem or manually create the file as previously posted.
# July 1, 2004 10:42 PM

scotty said:

yes, and thank you. This helped me
# August 6, 2004 7:10 AM

Bill K. Ross said:

Thanks a lot for the information. Setting the account to the <domain name>\<logon> rather than just the <logon> helped me to get this service working.

Greatly appreciate it.
# August 13, 2004 8:50 PM

This is one super duper site1 said:

This is one super duper site1
# December 25, 2004 1:40 AM

Naveen said:

thanks for the tip ...you have save alot of my time for tracing the error.
# February 26, 2005 10:25 AM

Uday said:

Great help.....
Thanks a lot dude.
# May 20, 2005 10:39 PM

Boris said:

You saved me
# June 13, 2005 4:05 PM

MZaldarriaga said:

Thank You. You saved me some frustation.
# December 15, 2005 1:15 AM

Jerry van de Beek said:

Thank you very mucht for putting this online.

It saved me a lot of time...and frustration!


# December 21, 2005 9:42 PM

Mitchell Guzman said:

I'm having this problem even changing the account.

this.ACATSWinFaxProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;

C:\WINNT\Microsoft.NET\Framework\v1.1.4322\InstallUtil.exe ACATSWinFax.exe >> InstallLog.txt

System.ComponentModel.Win32Exception: The account name is invalid or does not exist, or the password is invalid for the account name specified.
# December 22, 2005 11:07 PM

Fazlur said:

Thanks a lot
# January 24, 2006 1:43 AM

Tom said:

Was struggling for a while with this and found this entry really helpful! thanks
# February 27, 2006 3:40 PM

MIke said:

Thanks for posting this great tip.  It saved me a lot of time!
# March 8, 2006 8:55 PM

GopMan said:

Thanks a lot leaving this tip online that helped me correct the error with less time. Thanks once again.
# March 18, 2006 10:07 AM

Herald said:

Dankie dude. Service Service1 has been successfully installed. Ta Raaaaaa
# March 23, 2006 9:12 AM

Tom said:

Greetings from Poland!
# March 24, 2006 7:19 PM

Susan said:

Entering the domain\username worked. This saved my day! thanks
# August 1, 2006 7:23 PM

Raj said:

Great Help... Thanks a lot dude.
# August 7, 2006 10:29 AM