A couple of things to try.

  1. Display @ERROR and @SERROR after the "USE". This will give you the error code and hopefully the reason for the failure.
  2. Log on to terminal server and check that %CLIENTNAME% is correct for the XP workstations - it may not match the NETBIOS or DNS name that resolves to the client.
  3. Start a DOS session on the terminal server, and try "net view %CLIENTNAME%" and see what shares are visible.