I'm trying to get rid of all manually mapped network drives on all workstations in my domain. I want our end-user's mapped drives to be mapped solely via GPO (GPO's are already in place).
I'm trying to write a script that will:
- Unmap all network drives when the user logs in
gpupdate /fto re-map drives based on applied GPO
I'm planning to have this logon script policy applied only for a few weeks, until I can verify that all manually mapped drives are gone.
Here is the contents of my batch script:
REM Delete all mapped drives net use * /del /y REM force a group policy update to map all drives according to GPO's. gpupdate /force REM create a directory to verify the script is actually running. mkdir %USERPROFILE%\test
I've placed this script on my NETLOGON directory on my domain controller. The script runs as intended if manually run from this directory. However, when applied as a logon script, the
net use /delete /yes command doesn't seem to work. I've verified that the script is actually running during logon with the
I've even tried to redirect the output of the first command
net use * /del /y > result.txt and the output came out as
"There are no entries in the list"
Is there any reason why my script is working when I run it manually, but not as a logon script?
Server: Windows 2012R2
Host: Windows 10