Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / December 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim in Arizona - 10 Dec 2007 18:47 GMT
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
Jim in Arizona - 13 Dec 2007 18:52 GMT
<SNIP>
> I can set the Account property of
> the ServiceProccessInstaller1 to User. I've read that the account username
[quoted text clipped - 7 lines]
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.