batch file queries

G

Guest

iam trying to create some batch files but i am coming up short
here are my main problem areas:

1) trying to add a new user who is part of a specified domain
2) trying to rename computer - changing environment variables never saves
computername after reboot
3) tring to add netork tcp/ip port printers

any help would be much appreciated.
 
P

Plato

=?Utf-8?B?ZG1vcmFu?= said:
iam trying to create some batch files but i am coming up short
here are my main problem areas:

1) trying to add a new user who is part of a specified domain
2) trying to rename computer - changing environment variables never saves
computername after reboot
3) tring to add netork tcp/ip port printers

any help would be much appreciated.

I'm
I
Here
Trying
Any
 
P

Pegasus \(MVP\)

dmoran said:
iam trying to create some batch files but i am coming up short
here are my main problem areas:

1) trying to add a new user who is part of a specified domain
2) trying to rename computer - changing environment variables never saves
computername after reboot
3) tring to add netork tcp/ip port printers

any help would be much appreciated.

1) Type in "net help user" to see the many options.
2) I don't think you can do this. However, it has nothing
to do with environmental variables. To set them permanently,
use setx.exe (Windows Resource Kit) or setenv
(ftp://barnyard.syr.edu/pub/vefatica/setenv.exe)
3. netsh.exe might help you.
 
T

Torgeir Bakken \(MVP\)

dmoran said:
iam trying to create some batch files but i am coming up short
here are my main problem areas:

1) trying to add a new user who is part of a specified domain

As Pegasus wrote, look at "net.exe user".

2) trying to rename computer - changing environment variables
never saves computername after reboot

You can't rename a computer by setting environment variables.

If you want to rename a computer from the command line and not break
any domain membership, you will need to use Netdom.exe. More about
this here:
http://groups.google.com/group/microsoft.public.windowsxp.general/msg/15a4827e1fc9f732?hl=en&

3) tring to add netork tcp/ip port printers

I think an alternative is to use the prnadmin.dll that comes
with the MS Windows 2003 Server Resource Kit from a VBScript.


HOW TO: Programmatically Create a Printer and Printer Port by
Using PrinterAdmin (Prnadmin.dll) with a Visual Basic Script
in Microsoft Windows 2000
http://support.microsoft.com/default.aspx?scid=kb;en-us;321025


You will find Prnadmin.dll in this kit:

Windows Server 2003 Resource Kit Tools
http://www.microsoft.com/downloads/...69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en

(The kit will install on WinXP or later, but you can copy needed
files over to other computers, and then run regsvr32.exe against
prnadmin.dll)


More about PrnAdmin (from the RK help file):

Printer Administration Objects (PrnAdmin) is a COM-based tool that
provides large-scale, noninteractive control of printers, drivers,
and ports on local and remote computers.

Using PrnAdmin, you can:

Add and delete a local or remote printer.
Add and delete printer connections.
Add and delete a local or remote form.
Add and delete a local or remote standard TCP/IP port (of type
Line Printer Remote (LPR) or RAW).
Add and delete a local or remote driver.
View a list of printers, ports, drivers, and forms on a local or
remote computer.
Control and configure a local or remote printer.


PrnAdmin consists of several scriptable COM objects residing in
Prnadmin.dll, which functions as a wrapper around Printui.dll.
Several Microsoft Visual Basic Script (VBScript) sample files are
included with the tool.

Note

For more detailed information on how to use PrnAdmin.DLL, see
Prnadmin.doc. This white paper provides additional information on
printer, drivers, ports and forms to help administrators and
programmers manage a large number of local and remote printers.

Corresponding Operating System Features

All the functionality of prnadmin.dll can be duplicated using the
printers folder and various wizards. Converting printer ports from
LPR to Standard TCP/IP is the only functionality in prnadmin.dll
for which there is no corresponding GUI.

For more information about PrnAdmin and the Windows Management
Instrumentation (WMI) scripts in Windows Server 2003, see
Designing and Deploying Print
Servers(http://go.microsoft.com/fwlink/?LinkID=4745) in the
Windows Server 2003 Deployment Kit.


Files Required

Prnadmin.dll

The following sample VBScript files are also included:

Prnadmin.doc
Clean.vbs
Clone.vbs (there is no WMI equivalent for the cloning script)
Conall.vbs
Defprn.vbs
Drvmgr.vbs
Forms.vbs
Persist.vbs
Portconv.vbs
Portmgr.vbs
Prncfg.vbs
Prnctrl.vbs
Prndata.vbs
Prnmgr.vbs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top