How to avoid username and password in "Windows service" Setup project with account type = User. My requirement is such that Account type have to be User [not localservice, network service or local system] But during installtion I want's to avoid the prompt for username/ password I have tried following code in the projectinstaller but I am not able to get password so it fails
/*public String GetContextParameter(String key)
{
if (this.Context == null
|| this.Context.Parameters == null
|| !this.Context.Parameters.ContainsKey(key))
return null;
return this.Context.Parameters[key].ToString();
}
protected override void OnBeforeInstall(IDictionary savedState)
{
base.OnBeforeInstall(savedState);
String username = GetContextParameter("username");
String password = GetContextParameter("password");
System.Security.Principal.WindowsIdentity objw = System.Security.Principal.WindowsIdentity.GetCurrent();
serviceProcessInstaller1.Username = objw.Name;
serviceProcessInstaller1.Password = ........;//don't know how to extract password
}*/
Please help me how can i do that. What i want's is that currently windows service will be installed with currently loggedin username password will be automatically
Kamran Shahid (MCP,MCAD,MCSD.NET,MCTS,MCPD.net[web]) - Edited byKamran Shahid Monday, May 04, 2009 11:23 AM
- Moved byYiChun ChenMSFTTuesday, May 05, 2009 9:52 AMDeployment issue (From:Visual Studio Setup and Installation)
-
|
| Kamran Shahid Monday, May 04, 2009 9:44 AM |
If this is a VS 2008 setup project, the reason it's not working is that custom action code does not runwith the installing user's credentials. It runs with the system account. But anyway that's irrelevant.Even if you were running with the installing user's credentials you cannot get hold of the password - you just can't do it (it's not actually ever saved anywhere). You have to ask, that's the only way to get a password. Phil Wilson- Marked As Answer byKamran Shahid Thursday, June 25, 2009 7:26 AM
-
|
| PhilWilson Tuesday, May 05, 2009 5:36 PM |
Whatever the method, you still can't get a user's password without asking for it. If you need to verify that then ask in a security forum.
You always need the password - the issue is whether you need to prompt for it. Installer classes make you do that. Many setup tools support that standard ServiceInstall table:
http://msdn.microsoft.com/en-us/library/aa371637.aspx
where the account credentials can be specified in advance. There are products that actually create a user account at install time and therefore they know that password and have it set in the ServiceInstall table at install time.
Phil Wilson - Marked As Answer byKamran Shahid Thursday, June 25, 2009 7:25 AM
-
|
| PhilWilson Monday, May 11, 2009 6:51 PM |
Hi Kamran, I am moving this thread from Base "Visual Studio Setup and Installation" forum to the "ClickOnce and Setup & Deployment Projects" forum, since the issue is related to deployment. There are more deployment experts in the "ClickOnce and Setup & Deployment Projects" forum. Thanks
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. |
| YiChun Chen Tuesday, May 05, 2009 9:51 AM |
If this is a VS 2008 setup project, the reason it's not working is that custom action code does not runwith the installing user's credentials. It runs with the system account. But anyway that's irrelevant.Even if you were running with the installing user's credentials you cannot get hold of the password - you just can't do it (it's not actually ever saved anywhere). You have to ask, that's the only way to get a password. Phil Wilson- Marked As Answer byKamran Shahid Thursday, June 25, 2009 7:26 AM
-
|
| PhilWilson Tuesday, May 05, 2009 5:36 PM |
It is hapening in both VS2005 setup project and VS 2008 setup project. I have see number of windows service application who are installed as User Account without asking credential. I thought there must be some way to avoid this prompt
Kamran Shahid
(MCP,MCAD,MCSD.NET,MCTS,MCPD.net[web]) |
| Kamran Shahid Wednesday, May 06, 2009 6:28 AM |
Can any body tell me how some windows service application which run uder user account get installed without the username/password prompt Kamran Shahid
(MCP,MCAD,MCSD.NET,MCTS,MCPD.net[web]) |
| Kamran Shahid Sunday, May 10, 2009 8:09 AM |
Whatever the method, you still can't get a user's password without asking for it. If you need to verify that then ask in a security forum.
You always need the password - the issue is whether you need to prompt for it. Installer classes make you do that. Many setup tools support that standard ServiceInstall table:
http://msdn.microsoft.com/en-us/library/aa371637.aspx
where the account credentials can be specified in advance. There are products that actually create a user account at install time and therefore they know that password and have it set in the ServiceInstall table at install time.
Phil Wilson - Marked As Answer byKamran Shahid Thursday, June 25, 2009 7:25 AM
-
|
| PhilWilson Monday, May 11, 2009 6:51 PM |
Thanks PhilWilson. I Know the solution for creating new user during installation but this was not allowed in my requirement. All in all I think I can't avoid this username/password prompt like i want's [that is username and password of currently login person should be passed to the installer] Any way Thanks
Kamran Shahid
(MCP,MCAD,MCSD.NET,MCTS,MCPD.net[web]) |
| Kamran Shahid Tuesday, May 12, 2009 2:34 PM |
I think for my scenario there is no way to avoid username password [other then creating a user in active directory] Any way thanks all guys Kamran Shahid
Senior Software Engineer/Analyst
(MCP,MCAD,MCSD.NET,MCTS,MCPD.net[web]) |
| Kamran Shahid Thursday, June 25, 2009 7:25 AM |