Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


remove network drive by subnet

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,60274
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> remove network drive by subnet
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 remove network drive by subnet - 5/15/2008 5:48:44 PM   
  largo

 

Posts: 13
Score: 0
Joined: 5/15/2008
Status: offline
hello

i'm working in a company with a number of branches, each branch have a diffrent subnet : 10.172.30 , 10.172.40, 10.172.50
each branch have a local file server that the branch user is maped to him with a login script that do all the job.

i don't know how they worked until now but what happening if the user going to another remote branch is still getting the map drives
of his branch server, and that causing to a big slow down in both branches.

i want to write a vbscript that will remove the maped drive if the user is not in his original branch.
the thing is i don't have an idea how the script will to the "math" and see that the subnet is not of the user.

i'm not a vbscript excpert so i will happy for help with code lines.

thanks
 
 
Post #: 1
 
 RE: remove network drive by subnet - 5/16/2008 12:37:38 AM   
  dm_4ever


Posts: 2664
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Are you using Active Directory?  Have you set up sites information?

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to largo)
 
 
Post #: 2
 
 RE: remove network drive by subnet - 5/16/2008 1:08:43 AM   
  largo

 

Posts: 13
Score: 0
Joined: 5/15/2008
Status: offline
my company use active dirctory, i don't understand site information.

i need a script that will know for the example :

if joe is working in LA and going to work NY for a couple of hours and his getting the wrong map drives (LA)

the script will remove them .

< Message edited by largo -- 5/16/2008 1:09:52 AM >

(in reply to largo)
 
 
Post #: 3
 
 RE: remove network drive by subnet - 5/16/2008 2:00:01 AM   
  dm_4ever


Posts: 2664
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/directory/activedirectory/stepbystep/adsrv.mspx

You can define a site in active directory and specify what subnets fall under that site....so you could name one site LA and the other one NY and list the subnets that fall under those sites.

Your script could then map the drives depending on the site name and not have to worry about IP ranges...you can retrieve the site name the machine is in with something like this.

Dim objADSys : Set objADSys = CreateObject("ADSystemInfo")
WScript.Echo objADSys.SiteName

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to largo)
 
 
Post #: 4
 
 RE: remove network drive by subnet - 5/16/2008 2:49:31 AM   
  largo

 

Posts: 13
Score: 0
Joined: 5/15/2008
Status: offline
thanks dm_4ever

i learned something fromt his topic.

i will bring this up as an idea, but i think they look for a temp an easy solution like a script
to see if the slow down in the network come from a wrong network drive.

again if you can help with an idea to check the network drive unc and is wrong to remove it.

you know a way to extrect the ip address of the **server unc in the maped drive and compare it
to the local ip, if it's not match to remove the network drive ?



** the mapped drive go to a local server in the branch subnet

(in reply to dm_4ever)
 
 
Post #: 5
 
 RE: remove network drive by subnet - 5/16/2008 4:30:51 AM   
  dm_4ever


Posts: 2664
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Are the workstations WinXP or better?

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to largo)
 
 
Post #: 6
 
 RE: remove network drive by subnet - 5/17/2008 4:44:43 AM   
  largo

 

Posts: 13
Score: 0
Joined: 5/15/2008
Status: offline
winxp

(in reply to dm_4ever)
 
 
Post #: 7
 
 RE: remove network drive by subnet - 5/18/2008 12:04:14 PM   
  dm_4ever


Posts: 2664
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
These should help get you closer to what you are looking for

WScript.Network
EnumNetworkDrives
RemoveNetworkDrive
MapNetworkDrive
Split Function

Ping and resolve via WMI:  Win32_PingStatus (look at the Ping link in the frequently asked stuff post)
Ping and resolve via ping command:  WScript.Shell and Exec Method (also in the ping post)

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to largo)
 
 
Post #: 8
 
 RE: remove network drive by subnet - 5/20/2008 7:29:00 AM   
  largo

 

Posts: 13
Score: 0
Joined: 5/15/2008
Status: offline
i don't know how i did it but the Win32_PingStatus gave me a lot
thanks

(in reply to dm_4ever)
 
 
Post #: 9
 
 RE: remove network drive by subnet - 5/20/2008 8:13:14 AM   
  dm_4ever


Posts: 2664
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Good to hear!  

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to largo)
 
 
Post #: 10
 
 RE: remove network drive by subnet - 5/21/2008 11:55:25 PM   
  largo

 

Posts: 13
Score: 0
Joined: 5/15/2008
Status: offline
hello,

i wanted to ask how can i insert error log in case the map drive is using ip insted of host

thanks.


      

< Message edited by largo -- 5/22/2008 3:40:29 AM >

(in reply to dm_4ever)
 
 
Post #: 11
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> remove network drive by subnet Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts