NT/2K script writers

AllNyter

Junior Member
Feb 6, 2001
7
0
0
Just starting out... I wanted to know how to write a login script that would setup/map a printer for a user. Also do you guys know of a good book for script writing?
 

LocutusX

Diamond Member
Oct 9, 1999
3,061
0
0
Is mapping a printer anything like mapping a network drive? If so, I can tell you how I wrote a script (.CMD) that maps the hard drive on my NAT server as a drive letter.

I have a .cmd file (called startup.cmd or something) which contains the following line:

NET USE I: \\CR******\C$ <password> /USER:CR******\Administrator /PERSISTENT:NO

I find this technique to be more reliable than using the &quot;Map Network Drives&quot; button on the toolbar. I put this .cmd file in my local machine startup branch in the registry. Or you can put it in the Startup group.
 

bignick

Senior member
Apr 30, 2001
235
0
0
Go get the O'Reilly book &quot;VBscript in a Nutshell&quot;. There is a chapter on the windows scripting host (WSH). You can use it to map drives, and printers. Here is one my users have in their startup (startup.vbs):

on error resume next

dim wshnet, strprinter(3), intptr, objfo 'delcare my variables

strprinter(0) = &quot;\\servername\hp 4050_01&quot;
strprinter(1) = &quot;\\servername\hp 8000_01&quot;
strprinter(2) = &quot;\\servername\hp 8000_02&quot;

set wshnet = wscript.createobject(&quot;Wscript.Network&quot;) 'create a wsh network object instance
intptr = wshnet.enumprinterconnection 'enumerates printers
if intptr < 1 then 'if there is less than one printer add the rest
wshnet.addprinterconnection(strprinter(0))
wshnet.addprinterconnection(strprinter(1))
wshnet.addprinterconnection(strprinter(2))

end if

set objfo = wscript.createobject(&quot;Scripting.FileSystemObject&quot;)'create a filesystem object instance
if objfo.DriveExists(&quot;Z:&quot;) = FALSE then 'if no Z drive map it
wshnet.mapnetworkdrive &quot;z:&quot;, &quot;\\servername\userdata&quot;, TRUE
end if
set wshnet = nothing
set objfo = nothing
wscript.quit 'quit script
------------------------------------

hope this helps. also check out www.devguru.com for vbscript references
 

Shadow07

Golden Member
Oct 3, 2000
1,200
0
0
Will this login scrit only be for Windows NT/2000 clients? Or do you want it for Windows 9x/ME machines also? Please let me know, as I have created WSH login scripts for both OS's with much success. I can email you what I have and then I can tell you what you will need to change.
 

AllNyter

Junior Member
Feb 6, 2001
7
0
0
Thanks nick. Shadow it will be for nt/2000 workstations. Does the vb script need to be an .exe or can I write a .cmd or .bat Thanks................