0

I have about Windows 2008 R2 Remote Desktop Servers in farm. To the best of my knowledge they are all have the same update status and they are also goverened by the same GPO. Among others, users logging in via RDP execute a login skript mylogin.cmd that maps a drive I: unless for some individual reasons they already have such a drive:

if exist I:\*.* goto havei
eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO LogOnOffDebug /D "Try Map I:"
NET USE I: \\myserver\myshare /persistent:no 
eventcreate /ID 2 /L APPLICATION /T INFORMATION /SO LogOnOffDebug /D "errorlevel = %errorlevel%"
if exist I:\*.* goto havei
eventcreate /ID 3 /L APPLICATION /T WARNING /SO LogOnOffDebug /D "This is bad"
:havei

As you see, I already added some lines to debug the problem, and this is what I observe: I find events 1 and 2 in Event Log, but not event 3. So apparently,

  • the NET USE was executed because no I: files were seen,
  • the command executed without error,
  • and after execution I: is visible.

That is precisely what should happen and it does happen so on all farm members.

However, on two of the machines the users do not see drive I: in their sessions afterwrads! The same drive that was checked to be visible during login script execution just as on the other farm members! This looks to me as if the drives mapped during script execution are not "exported"(?) to the normal session. Simply executing the very same login script afterwards during their running session helps and gives them their drives, but this is of course not a suitable remedy.

What could even be the difference between the many good and the few bad servers that causes such behaviour? (I might add, that this phenomenon has crept up recently and had not existed for several years before - so something must have been done to the bad servers recently , but I have no idea what)

2
  • Why is it a .cmd file instead of a .bat file? Also, to be clear, that's not the whole script, right, it's just the debug code? Can we see the whole script, or at least the part that maps I:? Jun 6, 2019 at 13:26
  • How did you configure the login script execution ?
    – Swisstone
    Jun 9, 2019 at 17:42

3 Answers 3

1

If your users have existing network connection to other devices, most likely this will also affect your script when it comes to mapping. You can try disconnect all existing mapped drives from the script first

Net Use * /delete

Then you add your new mapped drives commands.

1
  • The only thing that affects the outcome is the rdp farm member they are allocated to. There are no conflicting drives Jun 6, 2019 at 9:38
0

if it's the script that start at logon of the user you could just put your batch in each server "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup " it will do the trick .

>

What could even be the difference between the many good and the few bad servers that >causes such behaviour? (I might add, that this phenomenon has crept up recently and had >not existed for several years before - so something must have been done to the bad >servers recently , but I have no idea what)

i personally got the same issue with a windows 2008R2 share in local network on local win 8.1 and 10 client they got the desktop services running but it was starting before the network one (as you imagine the share if persistent exist but with the red box, if not persistent i was simply not there because couldn't not connect with the net use cmdlet)

sorry for the typos or less than detailed name of the services couldn't find the right name of the services back in English (got my win 2008R2 upgraded)

2
  • I dont think this is a good solution. This might work as well but must be done for each User again. And With a login Script its centralised
    – djdomi
    Jun 7, 2019 at 8:26
  • you are not oblige to do it for each user there is a global startup folder and there is a user startup folder for reference there was once a question about this for windows powershell (check this out social.technet.microsoft.com/Forums/en-US/…) Jun 12, 2019 at 12:35
0

I suggest this to solve this eitger by this two Options

Batch Script 1;

net use Z:
if %errorlevel% EQU 0 net use I: /delete
net use I: \\path

Or, regardless map it every time again Script 2

if exist i:\ (
    net use i: /delete
)
net use i: \\path

The other Option is to map via gpo https://activedirectorypro.com/map-network-drives-with-group-policy/

I hope that this can fiy your issue

Since you did not told which serverfarm u use, ease Update US With more Informations. (sry cant comment yet)

1
  • Thanks for updating my Post. I Was not able to do so on my mobile.
    – djdomi
    Jun 7, 2019 at 8:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .