Link to home
Start Free TrialLog in
Avatar of NicoNL
NicoNLFlag for Netherlands

asked on

shortcut with script to startup mstsc.exe with all login information predefined

I want to create a shortcut to startup a remote desktop session with the mstsc.exe, with all information predefined. Not to use a RDP connection file. Predefined must be:
Logon domain name (not local login to the server)
Username (%username% ?)
full screen
Colors, High Color (15 bit)
Display the connection bar when in full mode
Local devices and resources - Clipboard (only)

Is this possible by using VB Script?





SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NicoNL

ASKER

Hi oBdA RobSampson, thank you for your reply. A pitty that VBScript can't be very much of help here.

The reason I'm looking for a workaround is because of a "logon to: this computer" problem.

We have upgraded our domain Active Directory to Windows server 2008, the functional level is still Windows Server 2003. from that moment on the users started complaining that they couldn't logon to the terminal server. From Remote Desktop Client 6.0 on there are improved authentication security features added, users have to enter their credentials twice. The second time in the "Log on to:" the local computer / server is automatically listed, instead of the domain name. Logon locally is blocked. Users have to manually select the domain to log on to, instead of the local server.

We have enabled the Always prompt for password GPO on the terminal servers. Users logon using a RDD file. It is possible to ad the string "EnableCredSSPSupport:i:0" to the RDP file to skip the first logon, but this disables the Vista support for Network Level Authentication added security. But anyway when we change Always prompt for password to "Not Configured" or add the "EnableCredSSPSupport:i:0", the logon screen still automatically selects Logon to the local computer/server, not to the domain. Also sometimes in the user field the ip address of the server is automatically added in from of the username 192.168.1.100\username, very annoying.

The only time it automatically selects the domain to logon to is when we ad the string "username:s:DOMAINNAME\USERNAME". When we leave out the username field and only ad "domain:s:DOMAINNAME", this isn't passed through to the login screen.

We want to avoid having to create a RDP file for every user, containing the string "username:s:DOMAINNAME\USERNAME". A pitty that %username% doesn't work in this feature.

Is there a work around to force "logon to: Domain", to avoid manually having to change it from logon to: this computer?
Avatar of NicoNL

ASKER

After a little bit more testing I've noticed that Vista adds the following string to the RDP file when saving it as a new file:
promptcredentialonce:i:1

This does not work for XP, nor for win2k3.

The string:
domain:s:domainname
does also work with Vista and 2008 Server.

Does anybody know if there is a patch / hotfix available to make promptcredentialonce:i:1 and domain:s:domainname function in XP or 2k3?
Avatar of oBdA
oBdA

As I said: if you're creating the rdp file dynamically through a script, then this can be done.
First, create an rdp file containing the information you require, then open it in Notepad (or your preferred text editor).
Add all settings (except username and domain) to the stub batch file below where you already see the settings for username and domain, and prepend them with
>>"%RDPFile%" echo
Adjust the name of the rdp file it's generating.
Save it as YourServer.cmd or Whatever.cmd.
Then simply start the script. If you start it through a shortcut, you can give it a nicer icon, for example from mstsc.exe or shell32.dll.

@echo off
setlocal
set RDPFile=%Temp%\YourServer.rdp
if exist %RDPFile% del "%RDPFile%"
REM *** Create a temporary RDP file containing user information:
 
>>"%RDPFile%" echo username:s:%UserName%
>>"%RDPFile%" echo domain:s:%UserDomain%
 
REM *** Start the RDP client with the file just created:
start mstsc.exe "%RDPFile%"

Open in new window

Avatar of NicoNL

ASKER

Wow, super! I think you just found the solution for me.
In the other sugested link https://www.experts-exchange.com/questions/23147592/Is-it-Possible-to-use-a-HTA-file-and-call-Remote-Desktop.html 
it is sort of the same solution using VBScript.

Great, thank you! :-))))))))
No problem. Thanks for the grade.

Regards,

Rob.