General discussion
January 28, 2008 at 05:14 PM
bmccord

.bat Vs .vbs

by bmccord . Updated 18 years, 6 months ago

I am in the process of writing a login script that will remove old printers and add new ones, map drives, check if apps are installed and if not install them and create a text file in a central place that will give all the User and PC info (time logged on and off, processer, Ram, service tag, ect). I’m new to scripting and am torn on witch way to go. I started with VB and before I go any further I want to make sure I?m headed down the right path. Below is a copy of the script I?m working on.
Option Explicit
Dim objNetwork
Dim WshNetwork
Dim objDrivemap
‘ Printers.vbs – Windows Logon Script.
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.AddWindowsPrinterConnection “\\rwsprt\HP1320_1368”
objNetwork.AddWindowsPrinterConnection “\\rwsprt\HP1320_customercare”
objNetwork.AddWindowsPrinterConnection “\\rwsprt\HP4100series_1333”
objNetwork.AddWindowsPrinterConnection “\\rwsprt\HP1320_payroll2”
objNetwork.AddWindowsPrinterConnection “\\rwsprt\okic5200n_1333”
objNetwork.AddWindowsPrinterConnection “\\rwsprt\HP1320_frontdesk”
objNetwork.AddWindowsPrinterConnection “\\rwsprt\hp1320_cfo”
objNetwork.AddWindowsPrinterConnection “\\rwsprt\HP1320_payroll”
Set WshNetwork = CreateObject(“WScript.Network”)
On Error Resume Next
WshNetwork.RemovePrinterConnection “\\dal1\dal_wk_1368”
WshNetwork.RemovePrinterConnection “\\dal1\OKI c5200n”
WshNetwork.RemovePrinterConnection “\\dal1\payroll”
WshNetwork.RemovePrinterConnection “\\dal1\payroll2”
WshNetwork.RemovePrinterConnection “\\dal1\frontdesk”
WshNetwork.RemovePrinterConnection “\\dal1\franchiseprinter”
WshNetwork.RemovePrinterConnection “\\dal1\fiery1368”
WshNetwork.RemovePrinterConnection “\\dal1\hp 4100”
WshNetwork.RemovePrinterConnection “\\dal1\dallasccprinter”
WshNetwork.RemovePrinterConnection “\\dal1\dallas_cfo”
WshNetwork.RemovePrinterConnection “\\dal1\Canon iR2200-3300 PCL5e”
Set objDrivemap = CreateObject(“WScript.Network”)
objDrivemap.MapNetworkDrive “G:” , “\\gg-file\data$”
objDrivemap.MapNetworkDrive “T:” , “\\gg-file\data\gg_data”
objDrivemap.MapNetworkDrive “F:” , “\\dal2\” & objDrivemap.UserName & “$”
Wscript.Quit

So far it will remove and add the printer and map the three network drives (one is user name specific)
Please let me know what you think

This discussion is locked

All Comments