Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Group Policy to mape drives/printers 2

Status
Not open for further replies.

ljCharlie

IS-IT--Management
Apr 21, 2003
397
US
Will anyone show me how to use group policy to map network drives and printers? I know how to use the old fashion way of a batch script on the user's properties, but I think there is an easier way to do this via group policy with Windows 2003 server.

Many thanks for those help.

ljCharlie
 
You need to know WSH scripting...using VB or JScript, etc.

Here a real simple example of doing this in vb:

Option Explicit
On error Resume Next

dim oNetwork, oDrives, oFSO, Drive
Dim sFinalDrive, iChar, sNewDrive

Set oNetwork = CreateObject("wScript.Network")
oNetwork.MapNetworkDrive "H:", "//London/LabShare"

Set oFSO =CreateObject("scripting.FileSystemObject")
For each drive in oFSO.Drives
sFinalDrive = Left(Drive, 1)
Next
iChar=Asc(sFinalDrive)
sNewDrive=Chr(iChar + 1)

oNetwork.MapNetworkDrive sNewDrive & ":", "\\London\labshare"

oNetwork.AddWindowsPrinterConnection "\\London\Classprn"

oNetwork.SetDefaultPrinter "\\London\Classprn"

Joseph L. Poandl
MCSE 2003

If your company is in need of experts to examine technical problems/solutions, please check out (Sales@njcomputernetworks.com)
 
Thanks! What is WSH scripting? I have and use VB before. The script you're talking about can be written in VB.NET, right?

ljCharlie
 
WSH scripting is essentially the "new" way of writing universal Windows scripts. WSH scripting is taking the place of batch files...kind of.

Windows 2000 OS's and higher all have WSH (Windows Script Host) installed by default; therefore, you can be pretty sure that the script will work on every targeted computer. I think Windows 2000 Sp0 has WSH version 2.0. Today, the latest available version is 5.6. WSH can be easily upgraded. Windows NT 4.0 OS's may also have WSH installed through patching and IE upgrades.

I would not recommend writing the script in .Net because the targeted computers probably won't understand the script. WSH scripting uses wSCript.exe and cScript.exe (Along with some other dll and ocx files.

By default, the computer scripts that all mentioned OS's understand is JScript and VBScript (VBscript is slightly different from full VB. VB is generally used to write applications where VBscript is meant for writing scripts. All of the full VB functions and code will not work in WSH.)

If you know full VN, you should be able to pick up VBscripting pretty easily.



Joseph L. Poandl
MCSE 2003

If your company is in need of experts to examine technical problems/solutions, please check out (Sales@njcomputernetworks.com)
 
So do I write the script in notepad or is there a program that I should be writing in?

Again, many thanks for your help and explanation. I'll give that a try and see what happens.

ljCharlie
 
Notepad is fine, but there are other free programs that are written specifically for writing scripts.
 
Notepad is good..you just have to save with the .vbs extention.

Joseph L. Poandl
MCSE 2003

If your company is in need of experts to examine technical problems/solutions, please check out (Sales@njcomputernetworks.com)
 
Nice script..i had to post so i can keep it in my "mythread" list.

MCSE 2K - MCSA 2K - NET+ - A+

Paul..
 
great info was looking for this type of advice.
"it is pretty strange that some post questions first rather than do a browse first!"
i used to do it but now "browse first to make sure nobody has asked the same type of question first!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top