Sending username/password/domain to remote pc to access services

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Terry Olsen

    Sending username/password/domain to remote pc to access services

    I have administrator access on 2 different domains on the network at my job.
    I wrote a program to query the registry key on remote PC's and return the
    results to an excel spreadsheet. However, the program only works for the
    domain I am currently logged into. If I try to query a machine on another
    domain I get "permission denied". So I have to log out and log back in to
    the other domain.

    I recently used a program that added users to a group on remote pc's. This
    program allowed you to enter your userid & password for each domain, then it
    went out to all the pc's in the list and added the users it needed.

    I have 2 questions now:

    1. How do I send userid, password, domain name to a remote pc for access?
    2. Add, change, delete users remotely?

    Thanks!


  • Rob Teixeira [MVP]

    #2
    Re: Sending username/password/domain to remote pc to access services

    You'll have to impersonate the other login. Query the .NET docs in MSDN for
    Impersonation and WindowsPrincipa l, and you should see some samples.
    Be careful of the options you pass to LogonUser (read the API docs for
    LogonUser carefully), because some options create a fast login token, but
    bypass some of the steps required to access network resouces.

    -Rob Teixeira [MVP]

    "Terry Olsen" <tolsen64@hotma il.com> wrote in message
    news:O1hHFDBIEH A.3432@tk2msftn gp13.phx.gbl...[color=blue]
    > I have administrator access on 2 different domains on the network at my[/color]
    job.[color=blue]
    > I wrote a program to query the registry key on remote PC's and return the
    > results to an excel spreadsheet. However, the program only works for the
    > domain I am currently logged into. If I try to query a machine on another
    > domain I get "permission denied". So I have to log out and log back in to
    > the other domain.
    >
    > I recently used a program that added users to a group on remote pc's.[/color]
    This[color=blue]
    > program allowed you to enter your userid & password for each domain, then[/color]
    it[color=blue]
    > went out to all the pc's in the list and added the users it needed.
    >
    > I have 2 questions now:
    >
    > 1. How do I send userid, password, domain name to a remote pc for access?
    > 2. Add, change, delete users remotely?
    >
    > Thanks!
    >
    >[/color]


    Comment

    • Rob Teixeira [MVP]

      #3
      Re: Sending username/password/domain to remote pc to access services

      You'll have to impersonate the other login. Query the .NET docs in MSDN for
      Impersonation and WindowsPrincipa l, and you should see some samples.
      Be careful of the options you pass to LogonUser (read the API docs for
      LogonUser carefully), because some options create a fast login token, but
      bypass some of the steps required to access network resouces.

      -Rob Teixeira [MVP]

      "Terry Olsen" <tolsen64@hotma il.com> wrote in message
      news:O1hHFDBIEH A.3432@tk2msftn gp13.phx.gbl...[color=blue]
      > I have administrator access on 2 different domains on the network at my[/color]
      job.[color=blue]
      > I wrote a program to query the registry key on remote PC's and return the
      > results to an excel spreadsheet. However, the program only works for the
      > domain I am currently logged into. If I try to query a machine on another
      > domain I get "permission denied". So I have to log out and log back in to
      > the other domain.
      >
      > I recently used a program that added users to a group on remote pc's.[/color]
      This[color=blue]
      > program allowed you to enter your userid & password for each domain, then[/color]
      it[color=blue]
      > went out to all the pc's in the list and added the users it needed.
      >
      > I have 2 questions now:
      >
      > 1. How do I send userid, password, domain name to a remote pc for access?
      > 2. Add, change, delete users remotely?
      >
      > Thanks!
      >
      >[/color]


      Comment

      Working...