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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drive mappings based on location (domain)

Status
Not open for further replies.

Soundlover4711

Technical User
Joined
Jul 27, 2005
Messages
15
Location
NL
Hi All!

I’d need a script fort he following case – who can hep me?!?

I have one (active directory) domain with 7 locations and 7 different ip-ranges. The users in our environment are getting 3 network drivers mapped.
My problem now is when a user from location1 moves with his laptop to location2 and logs on to the domain he’s getting all network drives mapped over the line.

For example: user1 which is located in location1 moves to location2 and log’s on to our domain and is getting the drives mapped regarding the LogOnScript.

The problem is we have very slow lines and I’d like to prohibit this so that user1 of location1 only gets his drives mapped when he is in location1. When he moves to location2 he should get NO drives mapped!

Is that possible?!?!?

Please help!!!!

Regards
 
faq329-5908

I hope you find this post helpful.

Regards,

Mark
 
Thank's!

But how can I merge this scrips???

I'd like to map a network drive when two parameters of the script are conform!

For example: When a specified group and a specified logonserver (GetLogonServer.vbs)or IP range (GetDHCPIPaddress.vbs) are matched then should be a drive mapped.

THANK'S A LOT

 
Just nest your Select Case and For Next statements:

Select Case location
Case "192.168.1.2"
For Each GroupObj In UserObj.Groups
Select Case GroupObj.Name
Case "Admin"
WSHNetwork.MapNetworkDrive "w:", "\\Server\Admin Stuff",True
WSHNetwork.SetDefaultPrinter "\\ServerName\PrinterName"
End Select
Next
End Select

I hope you find this post helpful.

Regards,

Mark
 
It's me again ;)

Whats wrong in this Script???
-----------------------------------------
On Error Resume Next

Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
".\root\default:StdRegProv")

Set WSHShell = CreateObject("Wscript.Shell")
strKeyPath = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys

DHCPAddress = WSHShell.RegRead("HKLM\" & strKeyPath & subkey & "\DhcpIPAddress")
If DHCPAddress <> "0.0.0.0" And Left(DHCPAddress,3) <> "169" Then
ActiveDHCPIPAddress = DHCPAddress
End If
Next

[green]'Now that we have the DHCP Address let's do something with it
'Grab the left 10 digits to determine subnet (example 192.168.1. or 192.168.2.)
'Modify the length as needed for your available subnets.

Select Case Left(AcitveDHCPIPAddress,10)
Case "10.64.152."
For Each GroupObj In UserObj.Groups
Select Case GroupObj.Name
Case "myGroup"
WSHNetwork.MapNetworkDrive "T:", "\\myServer\Share",True
End Select
Next
End Select
-----------------------------------------

BIG THX!!!!
 
You have a typo. Change tp this:

Select Case(ActiveDHCPIPAddress,10)


I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top