Adding Domain user to a local group

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

    #1

    Adding Domain user to a local group

    I am trying to create a small app using visual studio 2005 (vb), and I want
    to be able to input the users name and add the domain user to the local
    remote desktop user group. Here is the code I have so far.

    Dim LCL As New DirectoryEntry
    Dim DOM As New DirectoryEntry
    Dim DOMUSR As DirectoryEntry
    Dim LCLGRP As DirectoryEntry

    LCL = "WinNT://" & "PCNAME" & ",computer"
    DOM = "WinNT://domain"
    DOMUSR = DOM.Children.Fi nd("USERID", "user")
    LCLGRP = LCL.Children.Fi nd("LOCAL_GROUP ", "group")

    LCLGRP.Invoke(" Add", New Object() {DOMUSR.Path.To String})

    when I debug this I get the follow error on all four dim statements

    Error 1 Type 'DirectoryEntry ' is not defined.

Working...