How to add/remove local users on a remote machine

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Lasse F. Pedersen (lassefpedersen_at_REMaas.FOOnja.BARdk)
Date: 05/13/04

  • Next message: Björn Holmgren: "Re: How to add/remove local users on a remote machine"
    Date: Thu, 13 May 2004 13:32:36 +0200
    
    

    Hello,

    I have a class with a couple of functions, one for adding a local user on a
    remote machine, and one for removing a local user on a remote machine. I
    need to be able to do this. Each takes the name of the remote machine, a
    username (remote machine administrator), a matching password, and some
    details about the user to add/remove as arguments.

    In each function I'm using System.DirectoryServices.DirectoryEntry to
    connect to the given machine with the username and password specified, and
    supposing that these are in effect, I go from there...

    However! When I reach the point where I have to, in the add user function -
    for example, commit my changes to the new user entry (which was obtained
    from machineEntry.Children.Add(new_of_new_user)), I'm getting a "General
    access denied error."

    My question is:
    How do I create a local user on a remote machine which is not a member of my
    domain?

    I've tried using LogonUser and impersonation, but since most of the remote
    machines I need to access are not a member of the same domain as mine, that
    does not seem to be working for me either.

    Thanks,
    Lasse


  • Next message: Björn Holmgren: "Re: How to add/remove local users on a remote machine"

    Relevant Pages

    • Re: How to add/remove local users on a remote machine
      ... > I have a class with a couple of functions, one for adding a local user on a> remote machine, and one for removing a local user on a remote machine. ... I'm getting a "General> access denied error." ... > I've tried using LogonUser and impersonation, but since most of the remote> machines I need to access are not a member of the same domain as mine, that> does not seem to be working for me either. ...
      (microsoft.public.vb.winapi.networks)
    • Re: How to add/remove local users on a remote machine
      ... These newsgroups tend to be pretty agnostic to ... API and are the ... do this that doesn't require a domain or forest trust to the remote machine, ... >> I have a class with a couple of functions, one for adding a local user ...
      (microsoft.public.vb.winapi.networks)
    • Re: how to start up vncserver w/o login?
      ... they had got freenx or!M to make a connection to the native desktop on ... a remote machine without any local user having logged in on the remote machine ... This particular use for connection to a remote desktop is vital for me to ... manage a remote machine where the local user there is non-computer literate. ...
      (Fedora)
    • how to success OpenScManager for local machine when logged in with a user dont have administrator pr
      ... I logged in as a local user which do not have administrator privileges on ... Vista. ... It successed when the target machine is a remote machine, ...
      (microsoft.public.security)
    • Re: XMLA - Access Denied Error
      ... "Francis" wrote in message ... > promot the access denied error. ... > The error message is "The request failed with HTTP status 401: ... > My remote machine is a Windows Advanced Server 2000. ...
      (microsoft.public.data.xmlanalysis)