Windows script disconnect mapped drive




















This thread is locked. You can follow the question or vote as helpful, but you cannot reply to this thread.

I have the same question Report abuse. Details required :. Cancel Submit. Previous Next. WilliamDz Independent Advisor. Hi and thanks for reaching out. Track users' IT needs, easily, and with only the features you need.

Learn More ». JitenSh This person is a verified professional. Verify your account to enable IT peers to see that you are a professional. Akii This person is a verified professional. Bappy Sep 6, at UTC. If you are not using GPOs to set drives, run this on each machine as a scheduled task at the logon of any user Batchfile.

As you can see, each mapped drive actually has two entries in the collection. Take drive X, for example. The first item in the collection item 0 is the drive letter for drive X: X:.

One drive, but two entries in the mapped network drive collection. Each of the other drives also has two items in the collection, meaning our three mapped drives will result in a six-item collection, with items alternating between drive letter and UNC path. In order to remove a network drive, we need to call the RemoveNetworkDrive method, passing the method the drive letter for the drive to be removed. Which also means we need to figure out a way around this issue.

To that end, we use a For Next loop, looping from 0 the first item in a collection is always item 0 to the number of drives in the collection minus 1. Well, in a three-item collection item numbers would be 0, 1, and 2. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Script to disconnect mapped network location Ask Question.

Asked 8 years, 8 months ago. Active 2 years, 3 months ago. Viewed 21k times. System is Windows NT we use specialized software that hasn't had an update in a while. Improve this question. Kruug Kruug 5, 3 3 gold badges 21 21 silver badges 30 30 bronze badges.

Scott Can you expand on that script? I have very little scripting knowledge within Windows. Add a comment.



0コメント

  • 1000 / 1000