Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - VBscript to clear My Network Places?

Reply
 
Old 09-23-2008   #1 (permalink)
Dnort


 
 

VBscript to clear My Network Places?

Greetings all!

I'm quite new to programming and scripting, so please bear with me if I ask
seemingly mundane questions, m'kay? :-)

My employer has asked me to come up with a logon/startup script to use when
setting up a new server at a branch office. Basically, the script should
clean up any mappings referring to the old server on our employees desktop
computers. In order to minimize possible headaches when changing servers like
this, we've decided to name the new server with the same name as the old
server. Typically such changing of servers occur when servers are past their
designated end-of-life time, typically 4-5 years. Also storage might be a
factor, or should I rather say a lack of storage.

I would like my script to clear all stored network locations under "My
Network Places". That is, of course, everything except the standard "Entire
Network" and so forth. How would I go about that using VBscript? If there's
any other registry keys that come in to play, please let me know, so that I
can look into it. Like I said, I'm quite new to this winky smile

We've noticed that if there are lots of network shares located stored under
My Network Places, it will slow down Explorer significantly, especially on
CAD workstations. I reckon I'll alert the Desktop IT group about how to
Prevent Network Share Shortcuts from Being Added to My Network Places,
according to this MS KB article: http://support.microsoft.com/kb/242578, but
for the time being I'll have to come up with a script in order to clear
stored shares.

I've done some searhing for VBScripts to clear My Network Places, but I've
come up empty handed so far. I would greatly appreciate if someone could
point me in the right direction smile

Someone suggested I could use the following script:
Dim strNetHood, strMyDocuments

Set WshShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("WScript.Network")
strNetHood = WshShell.SpecialFolders("Nethood")
strMyDocuments = WshShell.SpecialFolders("MyDocuments")

Dim sNethoodArray( 6, 1 )
sNethoodArray( 1, 0 ) = "Name here"
sNethoodArray( 2, 0 ) = "Name here"
sNethoodArray( 3, 0 ) = "Name here"
sNethoodArray( 4, 0 ) = "Name here"
sNethoodArray( 5, 0 ) = "Name here"
sNethoodArray( 6, 0 ) = "Data"


Dim strDescription, strUNCPath, nIdx
For nIdx = 0 To UBound( sNethoodArray, 1 )
strDescription = sNethoodArray( nIdx, 0 )
objFSO.DeleteFile (strNetHood & "\" & strDescription & ".lnk")
Next

If I understand correctly, this script deletes entries under My Network
Places that are named specifally in the script. I really need some kind of
wildcard, as I have no idea how many locations and what their names are on
each client computer.

Any help would be greatly appreciated :-)


Regards
Dnort

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
how to clear recent places automatically General Discussion
What's in Network Places? Vista networking & sharing
MY NETWORK PLACES NOT RESPONDING Vista performance & maintenance
My Network Places Vista General
Network places Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46