Why are you using remote desktop? Are these computers networked? What are you trying to do? There might be an easier approach.
What I am doing is this - I have to Audit 1500 networked PCs via Remote Desktop using the usernames. What I do is Log in to 30 or so, by manually opening 30 remote desktop connections, copying and pasting in the computer names into the RDP gui, and then after I connect, a screen prompts me to click 'OK' to a pop up window before promting for my user name and password. I have the username and password already entered, so I need to bypass this 'ok' screen so the computer will start loading for me, so when the last of the 30 is done logging in, the first computer will be totally loaded up.
What I have done now, is written a batch file to auto read my computer names from a file, and open up RDP.
The problem is I still have to Click 'ok', or press enter/space before the computer logs me in and begins to load up the computer.
So when I run my batch file, it loads up 30 remote connections to 30 different computers very fast, but they all stay at that same 'OK' screen, so I then have to go to each one, and click OK, and then wait for them all to load up. This is what I would like to bypass.
I have tried entering a VBS script for sending a key into my batch file to run with the loop for opening the batch files, but I cant even get a sendkey to work in an already connected and open remote desktop connection. In using your VBS, I was able to activate the remote desktop connection (its called " computername - Remote Desktop" but the rest of the sendkey script does nothing, ie does not activate <CR>.
If I change your script to activate notepad instead of Remote desktop, then the key is pressed. This is why I'm thinking RDP will not allow sendkeys to activate inside the remote connection.
Maybe this will make it a bit more clear, any help is appreciated. If there is some script that will just press enter inside remote desktop, then I'm sure I could implement it into either my batch file or a VBS script.
PS I just tested your script below, and it works really well for opening one remote connection after inputting the username into the script, BUT after your script ended, I added another sleep and sendkey enter, but it does not carry into my remote desktop connection. I used the followint script:
Set objShell = CreateObject("WScript.Shell")
objShell.Run "mstsc /w:640 /h:480"
WScript.Sleep 2000
objShell.AppActivate "Remote Desktop Connection"
WScript.Sleep 100
objShell.Sendkeys "computer 1"
WScript.Sleep 100
objShell.Sendkeys "{TAB}"
WScript.Sleep 100
objShell.SendKeys "{ENTER}"
WScript.Sleep 10000
objShell.SendKeys "{ENTER}"