Home All Groups Group Topic Archive Search About

Map drives based on IP of computers



Author
10 Oct 2007 5:35 PM
Bryan
I am currently using this script to map network drives based on group
membership.
http://www.microsoft.com/technet/scriptcenter/resources/qanda/dec04/hey1210.mspx

I now need to modify it so it is also based on the location of the computer.
For instance we have a remote site that uses a ISDN connection and I dont
want the drive mapings to happen accros this link, instead I would like the
drive mappings to go to the local server and not accross the ISDN line.

So if the user belongs to group a and the ip is 192.168.36.1 then they map H
to server1\folders
And then if the user is in group a and the ip is 192.168.56.1 then they map
H to server2\folders

Let me know if anyone can help me or point me in the right direction.  I
hope all it is to just add a couple of lines in the script I am already
using.

Thank you
bthomp***@dhmh.state.md.us

Author
10 Oct 2007 6:12 PM
Richard Mueller [MVP]
Bryan wrote:

Show quote
>I am currently using this script to map network drives based on group
>membership.
> http://www.microsoft.com/technet/scriptcenter/resources/qanda/dec04/hey1210.mspx
>
> I now need to modify it so it is also based on the location of the
> computer. For instance we have a remote site that uses a ISDN connection
> and I dont want the drive mapings to happen accros this link, instead I
> would like the drive mappings to go to the local server and not accross
> the ISDN line.
>
> So if the user belongs to group a and the ip is 192.168.36.1 then they map
> H to server1\folders
> And then if the user is in group a and the ip is 192.168.56.1 then they
> map H to server2\folders
>
> Let me know if anyone can help me or point me in the right direction.  I
> hope all it is to just add a couple of lines in the script I am already
> using.
>
> Thank you
> bthomp***@dhmh.state.md.us

Retrieving IP address can get complex. One solution could be to use Computer
account group membership. All computers in a subnet could be made members of
a group, then test for computer object group membership. Another option is
to retrieve the Site from AD.

You can use properties of the ADSystemInfo object for this. The
Distinguished Name of the current computer is objSysInfo.ComputerName. The
name of the current site is objSysInfo.SiteName.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Author
12 Oct 2007 6:06 PM
Al Dunbar
Show quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:%23J$Mck2CIHA.2324@TK2MSFTNGP03.phx.gbl...
> Bryan wrote:
>
>>I am currently using this script to map network drives based on group
>>membership.
>> http://www.microsoft.com/technet/scriptcenter/resources/qanda/dec04/hey1210.mspx
>>
>> I now need to modify it so it is also based on the location of the
>> computer. For instance we have a remote site that uses a ISDN connection
>> and I dont want the drive mapings to happen accros this link, instead I
>> would like the drive mappings to go to the local server and not accross
>> the ISDN line.
>>
>> So if the user belongs to group a and the ip is 192.168.36.1 then they
>> map H to server1\folders
>> And then if the user is in group a and the ip is 192.168.56.1 then they
>> map H to server2\folders
>>
>> Let me know if anyone can help me or point me in the right direction.  I
>> hope all it is to just add a couple of lines in the script I am already
>> using.
>>
>> Thank you
>> bthomp***@dhmh.state.md.us
>
> Retrieving IP address can get complex. One solution could be to use
> Computer account group membership. All computers in a subnet could be made
> members of a group, then test for computer object group membership.
> Another option is to retrieve the Site from AD.
>
> You can use properties of the ADSystemInfo object for this. The
> Distinguished Name of the current computer is objSysInfo.ComputerName. The
> name of the current site is objSysInfo.SiteName.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --

If AD sites are not granular enough, I believe there is also a way to uad
ADSystemInfo to determine the subnet a computer is located in.

/Al

AddThis Social Bookmark Button