[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2208
  • Last Modified:

Logon script not working correctly in Windows Server 2008 x64 TS

I have a client that needs their users to map back to their local c: drive as w: while logged into a terminal session.  I created an OU just for the terminal server then created a GP for it I set loop back to enable replace I then changed User Configuration/Administrative Templates/System/Scripts scripts synchronously to enable.  Lastly I added a logon script to the GPO.  It is a simple .bat file with one line as follows:

Net Use W: \\%ClientName%\C$

If I run this command as written manually from cmd on the TS it works fine even as a regular user.  If I enable this same script for any other computers in the domain it works perfectly.  However this script is not mapping the drive on the W2K8 x64 TS when you connect from a winXP computer.  However if you RDP from a vista machine the script correctly maps the drive.  When I put a pause in the file I can see that when it is not running correctly the CMD window shows the line as Net Use W: \\\C$ and that does not get us anywhere.  So how do I get the drives to map correctly from the windows xp computers on the 08 x64 terminal server?
0
Fallbackpuppet
Asked:
Fallbackpuppet
  • 6
  • 5
1 Solution
 
mrmarkfuryCommented:
Why not include an if statement in your batch file that checks for XP machines, and when it finds an XP machine, uses %COMPUTERNAME% instead?
0
 
FallbackpuppetAuthor Commented:
I thought that %computername% would produce the name of the terminal server and not the client machine but I will try it.
0
 
mrmarkfuryCommented:
My mistake, didn't realize you were looking for the client's computer name
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
mrmarkfuryCommented:
Have you tried remoting into a TS with an XP client, going to the command line, and typing "set". See if CLIENTNAME is populated with the correct value.
0
 
FallbackpuppetAuthor Commented:
I have and it is.  this script works from either of the 2 vista workstations but not from any of the 25 xp workstations
0
 
FallbackpuppetAuthor Commented:
I tried to change it to a vb script form .bat script as follows:

ON ERROR RESUME NEXT

Set oShell = CreateObject("WScript.Shell")
STRComputer = oShell.ExpandEnvironmentStrings("%Clientname%")
STRConnection = "\\" & STRComputer & "\C$"

Set WshNetwork = CreateObject("WScript.Network")

WshNetwork.RemoveNetworkDrive "W:"

WshNetwork.MapNetworkDrive "W:", STRConnection

however that gave me the same results as the .bat file
0
 
mrmarkfuryCommented:
I'm guessing these clients on XP are using RDP, try updating the RDP client on one machine. I heard that there were certain builds that wouldn't pass %CLIENTNAME% properly.
0
 
FallbackpuppetAuthor Commented:
We are working with RDP CLient 6.1 and I can not find a newer one that will run on XP.  Also when you run either script after the client is logged in even with an xp client machine they work fine.
0
 
mrmarkfuryCommented:
Have you ensured no other Enforced policy is overriding the loopback ( I can't remember if loopback replace or enforce wins in a conflict)
0
 
FallbackpuppetAuthor Commented:
I thought of that but the only other policy does nto differintiate between xp and vist but this works on vista.  So I do not think so but I will double check.
0
 
FallbackpuppetAuthor Commented:
I figured it out I had to add the following reg key:

HKLM\Software\Microsoft\windows\CurrentVersion\Policies\System
Dword: EnableLinkedConnections with decimal value 1

Now either script works fine.
0
 
tom_ideCommented:
This registry entry change also works for logon.bat files that do not complete when users logon to a W2008 Terminal Server. My situation was that we use generic logon.bat files that map drives to locations that individual users may not have permissions to. When users logon to our w2008 domain from workstations, the logon.bat script jumps invalid mappings and completes the drive mappings that users have permissions to. When logging onto a W2008 Terminal Server, the same logon.bat file stops and requests a user name and password for each drive mapping that the user does not have permissions for. This freezes the logon to the terminal server. Adding this registry entry allows the logon.bat to run the same on the terminal server as the network logon. Invalid drive mappings are ignored, and the remainder of the logon.bat runs to completion.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now