All pastes #793132 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-21 23:35 UTC
rendered paste body
'---------------------------------------------------------------------
'setup the printshares
'---------------------------------------------------------------------
On Error Resume Next
'title for all dialog boxes
title = "STS Drive/print map script "
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\server\KONICA-C450PCL"
WshNetwork.AddWindowsPrinterConnection "\\server\HPLaserJ"
WshNetwork.AddWindowsPrinterConnection "\\server\HPOffice"
Err.Clear
'confirmed with Sheryl that all systems should default to LASER4 Printer. 20070703
WshNetwork.SetDefaultPrinter "\\server\HPLaserJ"
WshNetwork.AddWindowsPrinterConnection "\\server\HPOffice"
If Err <> 0 Then 
	MsgBox "Problem setting HP LaserJet as default printer:" + vbCR + vbCR + Err.Description,,title
end If
Err.Clear

'---------------------------------------------------------------------
'setup the s-drive share
'---------------------------------------------------------------------

'remove any existing mapping
WshNetwork.RemoveNetworkDrive "S:"
'ignore any errors on de-mapping the S: drive
Err.Clear 
WshNetwork.MapNetworkDrive "s:", "\\server\s-drive"
If Err <> 0 Then 
	MsgBox "There was a problem mapping the S-drive: " + vbCR + vbCR + Err.Description,,title
end If
Err.Clear

note, store the file at C:\WINDOWS\SYSVOL\sysvol\yourdomainname\scripts
then create a gpo on the intended OU and put location of script at UserConfig\Windows Settings\Scripts\Logon
location is: \\yourdomainname\SysVol\STSInc.local\scripts\drive-printer-mappings.vbs