?
Solved

HELP!  VisualBasic Logon Scripts (Mapping and Printers)

Posted on 2003-03-25
4
Medium Priority
?
195 Views
Last Modified: 2010-04-13
I am a system Admin for a small school, we have about 120 computers in total all running WindowsXP and all connected to a Windows2000 Server.  Previously I have written Logon scripts for connecting printers and mapping network drives as batch files but because of the need to disable students from accessing the command prompt this is now no longer possible.  I have no problem with mapping network resources but am in need of help when it comes to connecting to network printers (running of printservers and shared on computers) depending on the location.  Is there any way that this can be done in the policy?  I have very little knowledge of using VB scripts.
0
Comment
Question by:CliftonAdmin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
bonzai earned 150 total points
ID: 8211036
Hi

with this little vbscript, you can connect to printers


'-------------printers.vbs---------------
dim oNet, sPrintPath
Set oNet = CreateObject("WScript.Network")
sPrintPath = "\\server\printer"
oNet.AddWindowsPrinterConnection sPrintPath
oNet.SetDefaultPrinter sPrintPath
'----------------------------------------

greets
bonzai
0
 

Author Comment

by:CliftonAdmin
ID: 8213299
That is sort of what I need but I need some kind of "if" statment. i.e if computer name = \\PrimLab then connect to \\Printserver\PrimPrinter.  Location Dependant connections.
0
 
LVL 2

Assisted Solution

by:bonzai
bonzai earned 150 total points
ID: 8216143
this should work for you...


'----------------------------------------------
dim oNet, sPrintPath
Set oNet = CreateObject("WScript.Network")

Select Case oNet.ComputerName
  Case "computer1"
      sPrintPath = "\\server\printer1"
  Case "computer2"
      sPrintPath = "\\server\printer2"
   Case Else
      sPrintPath = "\\server\printer3"
End Select

oNet.AddWindowsPrinterConnection sPrintPath
oNet.SetDefaultPrinter sPrintPath
'----------------------------------------------
0
 
LVL 5

Expert Comment

by:cempasha
ID: 8595681
This question is still open and getting old. If any of the comment(s) above helped you please accept it as an answer or split the points who ever helped you in this question. Your attention in finalising this question is very much appreciated. Thanks in advance,

****** PLEASE DO NOT ACCEPT THIS AS AN ANSWER ********

- If you would like to close this question and have your points refunded, please post a question in community support area on http://www.experts-exchange.com/Community_Support/ giving the address of this question. Thank you      

Pasha

Cleanup Volunteer


0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
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…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

764 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