Hello
I am new to scripting, I have never done it before and I don’t know much about it. Please can people give me pointers and tech me how to make a script to map network drives & one to setup printers on computers.
Thanks A lot

Hello
I am new to scripting, I have never done it before and I don’t know much about it. Please can people give me pointers and tech me how to make a script to map network drives & one to setup printers on computers.
Thanks A lot
http://www.ss64.com/nt/con2prt.html
just stick an environment variable on each machine(can also be scripted) then it allows you to choose printers based on machine, you can also create a different script for groups, so admin get a different list to students,
net use z: /d
net use p: \\servername\public
should cover your mapped drives.
http://www.microsoft.com/technet/scr...qanda/all.mspx
generic good site for scripts, needs a little twiddling, but shows u what can be done
to map network drives, usually a batch file will do it. so if you know the dos commands for mapping network drives, that's usually the easiest way.
Create a text file (use notepad if you want) then save it as mapping.bat or something remember to save it as all files, otherwise it'll add the .txt extension on the end.
here's an example map.bat script
net use x: \\server\c$
Simple as that for mapping drives (prolly an easier way someone else can come up with)
vbs scripts etc get more complex.
Theres many ways to script!
Chris
gahhhhhhhhhhh beat me to it :P
Chris

Right and how would i apply that to a user account is it the box under the user profile location in the user properties in AD, i cant remember its name sorry.
Zak
yup, you can assign logon scripts to indivudal users, or do it in batches ( ie select a few users).
below is the vbs to set a variable on a machine.
------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objVariable = objWMIService.Get("Win32_Environment").SpawnInstan ce_
objVariable.name = "ROOM"
objVariable.UserName = "<system>"
objVariable.VariableValue = "INEEDS"
objVariable.Put_
----------------------
room is the varibale name, in INEEDS in this case is the variable.
so to make it work.
1. make logon script, save it to the netlogon file of your server.
2. assign script to user
3. assign variable to computer.
4. sit back and enjoy!.
below is a test script
rEM Mapping printers via an enviromental variable
\\servername\NETLOGON\CON2PRT /F
IF %ROOM% == SENIORICT \\severname\netlogon\CON2PRT /CD \\Servername\lanierlp025

I might sound stupid but i dont understand.Originally Posted by strawberry
not sure i do either :P.
bascially heres a list of things to do
1. download cntprinter file thingy, place it as a folder into your netlogon share of your server. \\servername\netlogon.
2.create a bat file, call it students.bat
3. copy code into bat file
---
rEM Mapping printers via an enviromental variable
\\servername\NETLOGON\CON2PRT /F
IF %ROOM% == SENIORICT \\severname\netlogon\CON2PRT /CD \\Servername\lanierlp025
---
4.change servername\lanierlp025 to a name of a shared printer on your network, save to netlogon folder
5.assign bat file to user as a logon script. ( as its in netlogon you can address just the file name eg NOT \\server\netlogon\students.bat but students.bat
6.set an environment variable on your pc , call it room, and set value to SENIORICT.
run script on your pc.

Right i think i get that.
I havejust been having a go with the map network drives one, i put the following into a notepad
I named it map.batnet use X: \\FN-DC-02\Network Drives\Enterpsie
net use Y: \\FN-DC-01\Network Drives\Shared Documents
net use Z: \\ST0\Media
Put it in "netlogon"
On the account properties i put map.bat on the logon script
But it doesnt work, Why?
try running it as a file on your computer, see if that works.
i'd bet x is a spelling mistake, and i think y needs brackets as dos doens't like spaces in address's.
net use Y: "\\FN-DC-01\Network Drives\Shared Documents"
you'll also need to use "net use u: /d" to delete each mapped drive as u logon, so delete the drives, then add the new drives, even if theyre the same.

is was these little "marks" that did it (what are the names again). ok so would i put "net use u: /d" at the bottom on the script?
put the delete (net use u: /d) first, then add the new drives. not sure why to be honest, the only use i can think of is when the system stands by and you need to run the logon script to refresh it when it wakes.

I bet your sick of me by now, I put the script as the following
But it isn’t deleting existing Network Drives, were have i gone wrong?"net use u: /d"
net use X: "\\FN-DC-02\Network Drives\Enterprise"
net use Y: "\\FN-DC-01\Network Drives\Shared Documents"
net use Z: "\\ST0\Media
Thanks for your help
quotes are only used to hide spaces in address from dos ( dos doens't like spaces).
net use x: /d
net use y: /d
net use z: /d
net use X: "\\FN-DC-02\Network Drives\Enterprise"
net use Y: "\\FN-DC-01\Network Drives\Shared Documents"
net use Z: \\ST0\Media
and is my pleasure, this website got me through the first year in my job so i'm only to glad to be helping others!
Visit this site http://www.microsoft.com/technet/scr...r/learnit.mspx
Get hold of some books on scripting I used Windows Scripting self paced learning guide and Windows 2000 scripting guide both from MS Press. Both books come with a Cd that contain all the example scripts. A simple vbs script to map two network drives, does the same job as the net use commands in the above posts.
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "P:" , "\\server\sharename"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "S:" , "\\server\sharename"
As you will see more drives can be added when needed, and with a few more commands you could test for group membership and map drives that are dependent on which groups you are a member of.
There are currently 1 users browsing this thread. (0 members and 1 guests)