I have a rather simple script that runs as a logon script which renames the Home Drive set by AD, script below

This works perfectly at logon if the user is connected to the Domain at the time of logon. If a user logs on off the network (I,e. working at home offline), when this script is run manually the mapped drive does not rename like it does at a logon where the computer is connected to the system.
Any ideas why it wouldn't work with a manual run, the users are local admins on the computers they are trying to run this on.

The results are the same, works when used as logon script but not running manually.
however a bit more information we realised to go with this, it only doesn't rename the drive if the drive as been offline and then comes online again.

No error messages are displayed, it run and then closes as expected, the drive just doesn't rename as expected.

jvierra wrote:For that to work the drive must be physically attached to the computer and not be a network drive. You cannot authenticate to a network share when not in the domain.

If it is a physically attached drive then you likely have other issues that have nothing to do with scripting.

Consider using the "label" command to verify what you are doing.

label /?

OK, a user logs on when at home and files are available offline.
The user then closes the lid on their laptop and puts the laptop to sleep.
When the user comes in school and wakes the laptop in a logged on states and connects to the network, the Offline Drive then goes back online and connects normally but has not been renamed.

Running the script at this time does not rename the drive.

A fresh logon where the script runs as a logon script, the same drive which is already on line renames with no issues