Results 1 to 5 of 5

Thread: user name and password in VB.NET windows services

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2004
    Posts
    22

    user name and password in VB.NET windows services

    hi,

    I am writting a windows service in vb.NET.
    I want to have the user that is running service. the user name and password as a global variable in my project.
    I want to work with ADSI functions so I need the both user name and password to make the function work and connect to domain.

    can any one give me a clue how to do that?
    any other suggestion beside getting the user name and password from service?

    thanks in advance.
    roseta.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    To get information related to users , you maybe need these function
    VB Code:
    1. Environment.UserDomainName()
    or
    VB Code:
    1. SystemInformation.UserDomainName()


    and
    VB Code:
    1. SystemInformation.UserName

    As for the password , I'm afraid you would need a lot of code related to security and permissions and could be some APIs .

  3. #3
    Addicted Member Dmyze's Avatar
    Join Date
    Mar 2002
    Location
    Seattle
    Posts
    160
    I may be wrong, but I believe if you do not use a username and Password with ADSI it will pick up the current user's credentials.

    If it's a windows service you can edit it's properties in the services manager to use a specific userid & password when it runs.
    -Daryl
    "Two More Rolls of Duct tape, and the world is mine!"
    VB.NET Guru

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2004
    Posts
    22
    Dmyz,

    thanks for your points. but if the service is not logged in what does it use? system account? then what happenes the system account should have privillage of the action.

    any other point is appriciated.
    roseta

  5. #5
    Addicted Member Dmyze's Avatar
    Join Date
    Mar 2002
    Location
    Seattle
    Posts
    160
    By default the service will use the system account, however it can be changed to any account in the service manager.
    -Daryl
    "Two More Rolls of Duct tape, and the world is mine!"
    VB.NET Guru

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width