AddUserToLocal ...frustrations..

jesse_mair used Ask the Experts™
Unable to find any info on this AddUserToLocal or AddUser.. Is this a VB6 command ? I need to find an example of how to use it .
Thank you.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
It's not VB local.  I found this on the net:

They are functions developed to wrap up the networking API calls for VB.


I know there is an easier way to do this than that link.
I have this .. But it is pretty "Ghetto"..
' creates and runs a batch file that adds the user and password...

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\testfile.bat", True)

    a.WriteLine ("net user USERNAME PASSWORD /add ")

Dim RetVal
RetVal = Shell("C:\testfile.bat", 0)

Thank ya..
I'm not saying that the information I provided was the best way to perform what you are looking to do (especially since you don't mention in the question what you are meaning to do).  You asked what the function was and I found it and explained it.  I do agree that if your goal is to do what your recent code shows, your method is probably an easier method.  However, your method is also a relatively unsafe method.  You have placed a username and password into a batch file.  You should at the least delete that batch file, and even then, someone can find that username and password if they look hard enough.  A deleted file isn't really deleted, it is simply marked for deletion.  Until that sector is used again and the information is overwritten someone can find the info.

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- Award the points to twalgrave

Please leave any comments here within the
next seven days.
Per recommendation, force-accepted.

EE Admin

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial