Link to home
Start Free TrialLog in
Avatar of sparkis
sparkis

asked on

ODBC Registry file LOGIN SCRIPT

Can someone please tell me how to insert "regedit.exe /s path of .reg file" into a login script. My current login script ends like this:

Sub RemovePrinter(Path)
      On Error Resume Next
            WSHNet.RemovePrinterConnection Path
      On Error GoTo 0
End Sub
Wscript.Quit

' End of Windows Logon Script

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sparkis
sparkis

ASKER

where should I put this in teh script? Do I have to add anytihng before or after?

Thanks,
Avatar of sparkis

ASKER

Option Explicit
On Error Resume Next
Dim WSHNet

Set WSHNet = CreateObject("Wscript.Network")

'Remove old printers
RemovePrinter "\\DC\Admin"
RemovePrinter "\\ DC \Server Copier"
RemovePrinter "\\ DC \Cannon Back Office"
RemovePrinter "\\ DC \Front Office"
RemovePrinter "\\ DC \Cannon Color"
RemovePrinter "\\ DC \Large Printer"
RemovePrinter "\\ DC \Ricoh Color"
RemovePrinter "\\ DC \2"


' Sub RemovePrinter
'----------------------------------------------------------------------------------
Sub RemovePrinter(Path)
      On Error Resume Next
            WSHNet.RemovePrinterConnection Path
      On Error GoTo 0
End Sub

Set objNetwork = CreateObject("Wscript.Network")


Dim objNetwork, strDriveLetter1, strDriveLetter2, strDriveLetter3, strDriveLetter4
Dim bForce, bUpdateProfile
strDriveLetter1 = "G:"
strDriveLetter2 = "S:"
strDriveLetter3 = "T:"
strDriveLetter4 = "U:"
bForce = "True"
bUpdateProfile = "True"

Set objNetwork = CreateObject("WScript.Network")
Dim strRemotePath1,      strRemotePath2,      strRemotePath3,      strRemotePath4

strDriveLetter1 = "G:"
strDriveLetter2 = "S:"
strDriveLetter3 = "T:"
strDriveLetter4 = "U:"
strRemotePath1 = "\\ DC \Data"
strRemotePath2 = "\\ DC \Shared"
strRemotePath3 = "\\ DC \ead"
strRemotePath4 = "\\ DC \Portfolio"

Set objNetwork = CreateObject("WScript.Network")

' Section which maps, G: S: T: and U:
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3
objNetwork.MapNetworkDrive strDriveLetter4, strRemotePath4


'
' Printers.vbs - Windows Logon Script.
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\ DC \Danielle"
objNetwork.AddWindowsPrinterConnection "\\ DC \Jill"
objNetwork.AddWindowsPrinterConnection "\\ DC \Barbara"
objNetwork.AddWindowsPrinterConnection "\\ DC \Scott"
objNetwork.AddWindowsPrinterConnection "\\ DC \Server Room Cannon Copier"
objNetwork.AddWindowsPrinterConnection "\\ DC \Cannon Color File Room"
objNetwork.AddWindowsPrinterConnection "\\ DC \Server Room HP Printer"
objNetwork.AddWindowsPrinterConnection "\\ DC \Cannon Color Back Office"

Sub RemovePrinter(Path)
      On Error Resume Next
            WSHNet.RemovePrinterConnection Path
      On Error GoTo 0
End Sub
Wscript.Quit

' End of Windows Logon Script
You can put it anywhere you like. May be at start.
Avatar of sparkis

ASKER

cooll thanks
Avatar of sparkis

ASKER

CodeCruiser:

I know this is closed but it is not working. Any help would be greatly appreciated.

I keep getting Variable is undefined: 'ObjShell', using the below script

set objShell = wscript.createObject("wscript.shell")
 
objShell.Run "C:\Windows\regedit.exe /s C:\WINDOWS\SYSVOL\sysvol\test.reg"
That is a strange error to be honest. I have checked again and the syntax is fine.