خرید بک لینک

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

  1. Unmap all network drives when the user logs in
  2. Run gpupdate /f to re-map drives based on applied GPO

I'm plaing 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 ruing.
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 ruing during logon with the mkdir %USERPROFILE%test.

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: 2012R2

Host: Windows 10

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 7 ارديبهشت 1395 ساعت: 2:26

صفحه بندی