Results 1 to 3 of 3

Thread: VB .NET Add/Delete/edit Windows accounts?

  1. #1

    Thread Starter
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    VB .NET Add/Delete/edit Windows accounts?

    I need to be able to Add/delete/change password of alot of accounts on a win 2k network.

    I have a List of users that need to be added every year, a list of users that need to be deleted, and all the users of a certain group need to have their passwords changed to a certain password

    is there any classes in the .net framework i can use to do this or do i have to use api?
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  2. #2

    Thread Starter
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622
    dug up some vb6 code but it needs some major changes to work in vb .net

    I have fixed most of it but need help replacing the StrPTR, varPTR functions

    anyone wanna try

    (why cant i attach *.vb files?)
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  3. #3

    Thread Starter
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622
    Well i have upgraded almost everything but I couldnt Figure these out:

    VB Code:
    1. Private Declare Function WNetEnumResource Lib "mpr.dll" Alias "WNetEnumResourceA" (ByVal pEnumHwnd As Integer, ByRef lpcCount As Integer, ByRef lpBuffer As NETRESOURCE, ByRef lpBufferSize As Integer) As Integer
    2.  
    3.     Private Structure NETRESOURCE
    4.         Dim dwScope As Integer
    5.         Dim dwType As Integer
    6.         Dim dwDisplayType As Integer
    7.         Dim dwUsage As Integer
    8.         Dim pLocalName As Integer
    9.         Dim pRemoteName As Integer
    10.         Dim pComment As Integer
    11.         Dim pProvider As Integer
    12.     End Structure
    13.  
    14.     Private Declare Function NetUserSetInfo Lib "netapi32.dll" (ByVal ServerName As String, ByVal Username As String, ByVal Level As Integer, ByRef UserInfo As Any, ByRef ParmError As Integer) As Integer
    15.  
    16.     Private Declare Function WNetOpenEnum Lib "mpr.dll" Alias "WNetOpenEnumA" (ByVal dwScope As Integer, ByVal dwType As Integer, ByVal dwUsage As Integer, ByRef lpNetResource As Any, ByRef lppEnumHwnd As Integer) As Integer
    17.  
    18.     Private Declare Function NetUserAdd Lib "netapi32.dll" (ByRef ServerName As Byte, ByVal Level As Integer, ByRef Buffer As USER_INFO_3, ByRef parm_err As Integer) As Integer
    19.  
    20.     Private Structure USER_INFO_3
    21.         Dim usri3_name As Integer
    22.         Dim usri3_password As Integer
    23.         Dim usri3_password_age As Integer
    24.         Dim usri3_priv As Integer
    25.         Dim usri3_home_dir As Integer
    26.         Dim usri3_comment As Integer
    27.         Dim usri3_flags As Integer
    28.         Dim usri3_script_path As Integer
    29.         Dim usri3_auth_flags As Integer
    30.         Dim usri3_full_name As Integer
    31.         Dim usri3_usr_comment As Integer
    32.         Dim usri3_parms As Integer
    33.         Dim usri3_workstations As Integer
    34.         Dim usri3_last_logon As Integer
    35.         Dim usri3_last_logoff As Integer
    36.         Dim usri3_acct_expires As Integer
    37.         Dim usri3_max_storage As Integer
    38.         Dim usri3_units_per_week As Integer
    39.         Dim usri3_logon_hours As Integer
    40.         Dim usri3_bad_pw_count As Integer
    41.         Dim usri3_num_logons As Integer
    42.         Dim usri3_logon_server As Integer
    43.         Dim usri3_country_code As Integer
    44.         Dim usri3_code_page As Integer
    45.         Dim usri3_user_id As Integer
    46.         Dim usri3_primary_group_id As Integer
    47.         Dim usri3_profile As Integer
    48.         Dim usri3_home_dir_drive As Integer
    49.         Dim usri3_password_expired As Integer
    50.     End Structure
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

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