?
Solved

Shell and ShellExecute

Posted on 2000-01-07
5
Medium Priority
?
448 Views
Last Modified: 2013-12-19
I am trying to automate the process of adding new users to an NT server.  Can I run the AddUsers program from ShellExecute in Visual Basic?  Is there a way to use:

Shell("C:\WINNT\system32\CMD.EXE", 1)

and then pass in the args to the command prompt once it is open?  Any suggestions would be much appreciated!!!
0
Comment
Question by:lmichalik
  • 2
  • 2
5 Comments
 
LVL 23

Expert Comment

by:Tim Holman
ID: 2332505
You could use Perl to do this sort of thing ?
You can use addusers with csv files to do bulk imports / exports (I think).
What exactly are you trying to achieve ?

0
 

Author Comment

by:lmichalik
ID: 2332533
I am creating a Visual Basic app that allows the user to enter the relevant parameters (username, password, group, etc.), and then automatically instantiates that user on the server.  I have already created the interface and am creating a text file that addusers will utilize (containing the relevant info).  

Now I just need to launch the add users program, giving it the info about the text file to use:

addusers /c c:\Users.txt

I have been looking at WinExec, CreateProcess, and Shell & ShellExecute.  I am pretty unfamiliar with API, so I'm unsure of how to proceed.  
0
 
LVL 8

Accepted Solution

by:
Brain2000 earned 800 total points
ID: 2332543
You can do this:

Shell("CMD.EXE /C addusers <arguments>")

This will cause CMD.EXE to run the string specified, the close CMD.exe when finished.  Note, you do not need to enclose the command string after /C in quotes, even if it contains spaces.
0
 
LVL 23

Expert Comment

by:Tim Holman
ID: 2332545
start addusers /c c:\users.txt ?

0
 

Author Comment

by:lmichalik
ID: 2333180
Thanks so much!  I couldn't find any specific documentation for the syntax on running this.  You were a great help!  :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A common practice in small networks is making file sharing easy which works extremely well when intra-network security is not an issue. In essence, everyone, that is "Everyone", is given access to all of the shared files - often the entire C: drive …
Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Suggested Courses

592 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question