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!

VB Login script help....

Status
Not open for further replies.

tinito

Technical User
May 21, 2004
32
GB
Hi All,

I was wondering if someone could please help me out with a login vbsript.
Am still a novice at VB, but am trying my best to do the following:
Judging by computername prefix (which is different from office to office)i would like specific prefixes to map their own drive mappings.
eg. london pc`s starting off with lon-
So if a pc starts off with lon- , it must go to the london area of the login script and map those drive letters.

Here is a sample of what i am trying to do, but am really struggling to write it.
It might not even make sense, sorry for it being such a mess.


Dim wshNetwork, sWorkstationPrefixlon, sWorkstationPrefixrea, sWorkstationPrefixdub, sWorkstationPrefixgil
set wshshell=createobject("wscript.shell")
Set ObjEnv=wshshell.Environment("PROCESS")
strComputerName = ObjEnv("COMPUTERNAME")
str2Search4 = "ctx"
sWorkstationPrefixbir = "lon"
sWorkstationPrefixrea = "rea"
sWorkstationPrefixdub = "dub"
sWorkstationPrefixgil = "gil"
Dim UserGroups(2000)
Dim GroupCount
Dim objGroup
Dim adsSystemInfo
sCommand = "%COMSPEC% /C "
Set wshNetwork = CreateObject(WScript.Network)


''' Ensure All Constants are in lowercase
Const LONDON = "lon"
Const READING = "rea"
Const GUILDFORD = "gil"
Const DUBLIN = "dub"



If InStr(1, strGroupsbir, BIRMINGHAM) Then

wshNetwork.MapNetworkDrive "L:", "\\dc-lon\Local_Sysdocs"
' wshNetNetwork.AddWindowsPrinterConnection "\\Eklinserver01\HP8000N"
' wshNetNetwork.AddWindowsPrinterConnection "\\Eklinserver01\HP8100N"
' wshNetNetwork.SetDefaultPrinter "\\Eklinserver01\HP8100N"


ElseIf InStr(1, strGroupsrea, READING) Then

wshNetNetwork.MapNetworkDrive "L:", "\\dc-rea\Local_Sysdocs"
' wshNetNetwork.AddWindowsPrinterConnection "\\Eklinserver01\HP8000N"
' wshNetNetwork.AddWindowsPrinterConnection "\\Eklinserver01\HP8100N"
' wshNetNetwork.SetDefaultPrinter "\\Eklinserver01\HP8100N"

ElseIf InStr(1, strGroupsgil, GUILDFORD) Then

wshNetNetwork.MapNetworkDrive "L:", "\\dc-gil\Local_Sysdocs"
' wshNetNetwork.AddWindowsPrinterConnection "\\Eklinserver01\HP8000N"
' wshNetNetwork.AddWindowsPrinterConnection "\\Eklinserver01\HP8100N"
' wshNetNetwork.SetDefaultPrinter "\\Eklinserver01\HP8100N"

ElseIf InStr(1, strGroupsdub, DUBLIN) Then

wshNetNetwork.MapNetworkDrive "L:", "\\dc-dub\Local_Sysdocs"
' wshNetNetwork.AddWindowsPrinterConnection "\\Eklinserver01\HP8000N"
' wshNetNetwork.AddWindowsPrinterConnection "\\Eklinserver01\HP8100N"
' wshNetNetwork.SetDefaultPrinter "\\Eklinserver01\HP8100N"


End If


Set wshNetwork = Nothing









 
I have 2 FAQs that will bebefit you greatly. Take a look at these then post back if you still need help and I will be happy to assist.

faq329-5798
faq329-5908

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top