Rename Mapped Drive

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
Posts: 38
Last visit: Mon Oct 02, 2017 7:11 am

Re: Rename Mapped Drive

Post by devereux0110 »

jvierra wrote:I thought the issue only happened when the user was not connected to the network.

Why are you renaming a drive that is not connected?

I am afraid that this is a hardware issue and not a scripting issue. It may also be a result of trying to use the shell to rename a disconnected drive. The shell is not intended to be used this way.

You can use the net mapping commands to label a mapped device. It will usually be more reliable.

I am not trying to rename a drive that is not connected, at the time of running the script, the user is connected to the network and online.

Each user has an icon on their Desktop, "sort My Desktop", this runs a script which maps 5 network drives and renames them. The same script then renames the now connected W: Drive which the user as been using off line but has now connected back to the network.

The same script is also set to run as a logon script. If the user as to use the desktop icons because they logged onto the computer offsite, the script maps the 5 network drives and renames them and then trys to rename the W: Drive but it does rename.

When the same script is run as a logon script where the user is connected to the network at the time of logon, the a script maps the 5 drives and renames them and also then renames the w:\

At no point am I trying to rename a drive which is offline, it cant be an hardware issue as it wouldn't work as a logon script if it was an hardware issue.

Posts: 14876
Last visit: Fri Jul 30, 2021 8:16 am
Answers: 12
Has voted: 3 times
Been upvoted: 10 times

Re: Rename Mapped Drive

Post by jvierra »

You said it yourself. The other drives all work correctly. Only this one is an issue. Yu are trying to re-connect to a network drive. All others work except one. Why is that a scripting issue. It has to be either configuration or an issue with how GPO is set up. I suspect it may be set to run synchronously. That can change the behavior completely.

Since we cannot see you systems or run any tests there doesn't seem to be any way to help you.

Remember that the shell is not really designed to be used with scripts. It can have very odd behaviors when run in a script. You should consider looking into other tools to set up the drives.

You could also try using PowerShell to see if that helps at all.

Other than those suggestions I cannot see how we can help.