HighTechTalks DotNet Forums  

Using the proper account for ServiceProcessInstaller; How To Set Usrname/Passwrd for User account

Dotnet Security microsoft.public.dotnet.security


Discuss Using the proper account for ServiceProcessInstaller; How To Set Usrname/Passwrd for User account in the Dotnet Security forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jim in Arizona
 
Posts: n/a

Default Using the proper account for ServiceProcessInstaller; How To Set Usrname/Passwrd for User account - 12-10-2007 , 01:47 PM






Using VB.NET with .NET Framework 2.0

I made a windows service with code to move files out of a folder on the
computer where the service is installed to a shared folder on another
computer on the local network (LAN). The problem I run into is which
security principal (service account) to use for the ServiceProcessInstaller
which is set on the properties of ServiceProcessInstaller1 under the Account
property. You can chose either LocalService, NetworkService, LocalSystem or
User.

I've ran into various problems using NetworkService and LocalSystem accounts
such as not enough permissions to delete the files from the file system or
not being able to access any network resources.

I can set the Account property of
the ServiceProccessInstaller1 to User. I've read that the account username
and password can be set for this (such as a domain user account) but I can't
find any examples of how this is done. If I was able to do this, it would
solve all my permissions problems.

Does anyone know how to do this?

Thanks,
Jim



Reply With Quote
  #2  
Old   
Jim in Arizona
 
Posts: n/a

Default Re: Using the proper account for ServiceProcessInstaller; How To Set Usrname/Passwrd for User account - 12-13-2007 , 01:52 PM







"Jim in Arizona" <tiltowait (AT) hotmail (DOT) com> wrote

<SNIP>
Quote:
I can set the Account property of
the ServiceProccessInstaller1 to User. I've read that the account username
and password can be set for this (such as a domain user account) but I
can't
find any examples of how this is done. If I was able to do this, it would
solve all my permissions problems.

Does anyone know how to do this?

Thanks,
Jim

I was amazed to see that no one had an answer for this. After further
investigative work along with trial and error, I found that setting the
username/password was really easy. I made a domain account, set permissions
on the folders on both ends, made a security template to give the account
permission over a specific service I wanted my code to start/stop, and
everything then worked.

When adding a Project Installer for the service, you can then view the code
of the ProjectInstaller.vb file and add the appropriate credentials there.

Imports System.ComponentModel
Imports System.Configuration.Install

Public Class ProjectInstaller

Public Sub New()
MyBase.New()

'This call is required by the Component Designer.
InitializeComponent()

'Add initialization code after the call to InitializeComponent
ServiceProcessInstaller1.Account =
ServiceProcess.ServiceAccount.User
ServiceProcessInstaller1.Username = "domainname\accountname"
ServiceProcessInstaller1.Password = "passwrd"

End Sub

End Class




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.