Remote Desktop Application - Start multiple sessions on my client PC - remote-desktop

I have a windows 2016 server running RDS. It is configured to run a single application when a user accesses it from a .rdp shortcut. The user just sees the application as though it is running on their local machine, not a whole remote desktop.
If from a client PC, if I launch the application and log in then I can see a new connection in the RD Gateway manager.
However if I launch the application from the same client PC multiple times I am only asked to login the first time, and whilst I see many instances of the application I only see one connection in the RD gateway manager.
I would like a new connection each time I launch the application, so that I can simulate multiple users running the app concurrently in their own sessions.
I have tried adding "prompt for credentials on client:i:1" to the .rdp shortcut and this has no effect.
Thanks you your help.

I don't think it's possible. Let me try to explain:
Whenever you launch the RDP file, you connect to a session on the RDSH. Now, if you want separate connections, that means that there should be multiple sessions (probably for the same user since the credentials don't change) which is not allowed by the RDSH by default.
Assuming you get passed multiple sessions for same user, MSTSC actually recognizes that for the given RDP file, there is already an open connection, so it will try to reuse that.
Last but not least, there is the problem of licensing - you are "working around" the system: both per-device and per-user licensing would report 1, therefore it would probably be a violation of ToS.
It would be much more useful if you could tell us what you are trying to achieve and then maybe we can help you more.
P.S.: This question has nothing to do with programming, so it probably belongs to https://superuser.com

Hi I figured out a solution to this, so I will share in case it is useful for anyone else.
Modify the hosts file to include different names for the target machine ip address:
eg:
51.xxx.159.233 test1.xxx.uk-user1
51.xxx.159.233 test1.xxx.uk-user2
51.xxx.159.233 test1.xxx.uk-user3
51.xxx.159.233 test1.xxx.uk-user4
Then in each rdp launch shortcut, reference a different alias.
eg:
Shortcut1:
full address:s:test1.xxx.uk-user4
Shortcut2:
full address:s:test1.xxx.uk-user3
Then when the RDP is launched it will ask you to log in even if you already have an active connection and server will have a new user logged into it.
Hope this helps somone in the future.

Related

Way to Refresh Network Drives due to Disconnection from Pending VPN Connection without Workflow Interruption

Most of my company is currently working from home and is having to tunnel into our office network through a VPN. As such, all our network drives are, technically, disconnected until we login to the VPN. Once connected, we could simply open a file explorer window and open each network drive to reestablish/refresh the connection in Windows' eyes, but more than 2 or 3 drives is a hassle, and some of our members don't even think to do this every day even for our main project drive (only universal drive letter we use in our office) before opening some of our programs that need a network drive mapped, and thus have the potential to mess up our files or link therein.
Desired Solution:
I'm looking for a batch or cmd file that can run to refresh or reconnect the drives, without explicitly using NET USE if possible (more on why further down) or opening a file explorer by using a batch file to open a shortcut to a network folder. If this just isn't possible, I'll stick with the solution I have that uses NET USE, but would appreciate help smoothing out the issues outlined below.
I have a couple solutions that are more than a little intrusive in that they require some form of interaction to dismiss them once launched, rather than running, reaching eof, then closing using TIMEOUT /T 5. I was hoping there might be something a little more streamlined, or at least less intrusive, that I could use to avoid these unnecessary interactions that I'm currently dealing with:
Shortcut to a folder on each drive to "ping" said drive for refresh, but this opens a file explorer window, potentially interrupting workflow. I would like to suppress this window opening if possible, or at least immediately close it (not exactly how file explorer works, I know).
Batch file that tests all mapped drives for disconnected ones, then attempts to reconnect, sometimes causing a user input in the cmd window to interrupt workflow (We have two security levels each with their own login credentials, and several of us have mapped network drives using each of the two creds, so some disconnected drives will require manual entry of username and password when the /USER:%username% %password% parameters don't work, which I just can't seem to avoid. Neither server nor network location for NET USE are viable tests for which security level, as their labeled after the project itself rather than the security level needed, and so my only remedy here would be to suppress the asking for user input).
Multiple batch files, one for each drive, requiring users to manually copy and alter batch files for their own needs (only one drive is universally used for each project we're on, and even then some people are one different projects), then updating the task scheduler to run each of their created files (not at all desirable, and as far as I'm concerned, unacceptable). If nothing else can be modified or work without interference, I can just using this to run on our company's default project drive letter, and let people worry about reconnecting the others as needed.
I have a task scheduled for any time our VPN client reports a connection, which due to our home networks and/or the connection between us and the VPN servers, could occur multiple times a day (I've had up to 4 or 5 "connection" events trigger my task after the initial login, though I only have to explicitly login the one time), which can cause further interruptions in workflow beyond just the initial VPN login run. I'm willing to accept any solution that uses NET USE as long as I can suppress the request for user input if the Windows login password doesn't work, or a shortcut if I can prevent the opening of a file explorer window. Alternative solutions are preferred, but I understand that may not be possible.
I have tested using DIR //server/foo, but it timed out for the same reasons that file explorer doesn't display the network drive as "connected" after VPN login is successful.
I've also had mixed results with setting the task scheduler to run my program off of a network connection as opposed to the "connect" event from our VPN client, mostly in that it didn't run reliably, if at all, as I needed to wait until I was connected through the VPN, not just standard internet connection through an ethernet cable. For this, I tried using both methods here, but none of the networks that are available after VPN login seemed to trigger the task properly, even though manually triggering the even through Task Scheduler showed the action would run fine. As such, I'm considering this as a failure, but can revisit if no more streamlined solutions are available or I can get a guarantee this method won't trigger as often (preferably only once per login) as watching the VPN client for its connection event.
At this point, I'm stuck with two solutions that have a high potential to interrupt workflow and annoy the user too greatly for me to want to send out as a final solution (a for loop on NET USE where drive is disconnected and a batch file to open a shortcut that opens a window front and center), and another solution that I consider to limited in scope and as a last resort. I'll make due if there's not a better way to handle either of the first two, but in the mean time, I would greatly appreciate any help/advice!
Edit:
On a side note, I do expect to have the cmd window pop-up briefly, then close automatically once the operations are done (like it would with the shortcut solution), so some amount of workflow interruption will likely be unavoidable. What I'm considering unacceptable is that I can't minimize it and prevent the user form having to interact with it directly or indirectly to get the cmd or resulting window to close after it takes the active window status from whatever program user was previously in.
Edit 2:
I've posted this query elsewhere with this additional recap to help narrow my request:
As a recap, I'm looking for a solution for refreshing network drive connections that do no rely on Credential Manager, will not require user input if network drive credentials differ from windows login credentials, and will not pop-up a window that requires user to close manually. Brief workflow interruptions resulting from cmd or child-process windows popping up before closing automatically are acceptable, with a preference towards one of the two solution avenues I already have running. Thanks again for any input you may have!
I had the same problem. I have 4 mapped drives to reconnect to when I open the VPN and it was a real pain. I have looked for batch file solutions in vain.
My solution is to use a free program called FBackup. I use it anyway for the intended purpose of backing things up, but I noticed that when it opens, it reconnects all of my drives (including the mapped drives using the VPN to the office)
So after I connect, I open FBACKUP. It makes all of the connections for me, then I just shut it down. Job done.
1 this probably belongs on the site that this site was made to head up against, which I am unsure if I am allowed to reference by name on this site.
That said if it was at this site you probably want topost on Superuser.
That said..
For users with more than one drive mapping you want to store thier credentials used in windows credential manager so that the drives can automatically be mapped without specifying a username and password each time.
That will allow your batch script to run in the background and re-map the drives
In lack of a better answer that is viable for our setup (will definitely remember Ben's answer for later, in case I'm able to use it for the lower security profiles), I've decided to go with a more limited scope for my batch file, since I have yet to find any info that will allow me to suppress a file explorer window or request for user input from the cmd window (for password) when attempting to refresh connection to all saved network drives.
Since the one drive that absolutely must be reconnected is, by our guidelines, universally assigned to the same letter (mapping changes depending on the primary project we're on), I've opted for just refreshing this drive as the credentials for this drive will always match the Windows login credentials, and thus won't request user for input if a password is wrong.
I will keep tabs on this question, so that if someone else comes along and has a better solution, I will definitely swap the selected answer to them.

Server Remote Desktop

I am helping a friend out with his new startup and he is looking into the possiblity of buying a server. A big part of the business involves running scripts to test various programs. The scripts automate mouse movement and clicks and keyboard inputs, basically mimicing a human user and logging how to program responds.
I understand that using virtualization, he could have one server running multiple instances of the operating system simulatnously. Unfortunately I don't have any experience with this.
What we would need to do is as follows:
Open an instance of remote desktop instance on the server through a laptop.
Run one of the automation scripts and watch the mouse move around the screen doing its work
Close the remote desktop on my laptop but leave the script running with the mouse moving around the virtual screen doing its work
Open 10 more instances of remote desktop to do the same thing
Login to each remote desktop a week later and check the progress
Basically if I close an instance of remote desktop, is there a way to keep the automated mouse movement script running?
Is there a limit to the number of instances that can be run at once?
I'd be greatful if someone could point me to some instructions on how this would work? As you could probably guess neither of us are IT experts! Thank you

Mapping a network drive only when connected to a Domain

I have looked around a bit, and I haven't found a solution that exactly fits my needs. I have a Laptop that I use for work, and for personal use at home. At work, we are operating on a Domain, and have several Network Storage locations that I use often. So i decided that I want to Map these drives. However, I do not want to get popup messages nor see that these drives are disconnected when I am at home, and there is no connection to these servers. Is there a built in way to accomplish this task in windows 7, or am I going to need to resort to a start up script. If I need a script, how can I check to see if the computer is connected to a Domain, and then map drives based on that option. If a script is required, I would prefer to use a .bat file. Another route that would be achievable is doing this through group policy if someone can direct me as to how to push certain mapped drives to specific users.
Without more details, I believe if value of the Windows variable USERDOMAIN is equal to the value of COMPUTERNAME then your host is not in a domain
If %USERDOMAIN% <> %COMPUTERNAME% SET indomain="y"
Alternatively, you can 'hack' it by trying to do something like a DIR of a folder like WINDOWS on a computer that's part of the domain. If you get denied then you're not part of the domain.

Execution of QTP scripts on remote machines

I am posting this question regarding the execution of QTP scripts on remote machine. When i log in to my remote machine via "mstsc", and execute the script without closing the remote desktop connection, it works fine. But once i close/minimize the remote desktop window, it starts throwing error ( like Object not visible" error.
One of the places where it generally throws error is while clicking on the file menu in IE, as shown below :-
Browser(" page name -").WinToolbar("ToolbarWindow32").Press "&File"
Are there any workarounds to resolve the same??
Most of the QTP scripts take lot of time to execute, and if the prerequisite is to keep the screen active without even locking, isnt it one of the key disadvantages?
Thanks in advance!!!
Steve
QTP replays some steps by manipulating the mouse and keyboard devices. When an RDP session is minimized windows knows that there is nobody at the controls and therefore doesn't respond to the mouse and keyboard events which causes QTP to fail.
A workaround to this is to connect to the machine via another application rather than mstsc (for example VNC) which doesn't communicate to windows that it has been minimized. Either that or leave the RDP window open.
If you want to run QuickTest in a minimized RDP session, and you are using an RDP >= 6.0 client, you can enable it by setting a registry value on the local computer:
Navigate to one of the following registry paths on the local computer:
Current User: HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client
or
All Users: HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client
Create a DWORD value named RemoteDesktop_SuppressWhenMinimized and set it to 2.
Note that this does not work when the computer is locked or logged off.
one more simple way
just maximize RDP session , then scripts will run don't minimize
you remove the lock of the machine.

RDP connectivity/responsiveness test

I want to write an app to test whether a Windows machine is responding correctly to RDP (Remote Desktop) - i.e. to check if the machine not only allows the connection, but is also responding normally, and is not hung or otherwise responding abnormally.
Is there a library or utility that I can use to do this? My searches turned up full RDC clients, but I'm hoping there's something out there at least offers an API for testing. I would most like to use Java or a scripting language to do this, but I'm open to suggestions.
You can find some good answers in this question: Programmatically create and launch and RDP session (without gui)
Because RDP is a constantly evolving proprietary protocol, i'm guessing there isn't some simple open-source code you can take and use. This leaves us with two possible paths to follow:
Use Microsoft RDP ActiveX control (on Windows)
Launch mstsc.exe and send keyboard events to it (also on Windows, using your favorite language)
For the second option, I suggest AutoHotkey. It is perfect for automating windows programs and comes with a powerful library. It also has a strong comunity behind it so you can find lots of useful scripts on the internet. I use it to control winamp (like 'i hate this song! delete it and move to next')(well, technically 'move to the next song and delete the previous' because you can't delete the file while in use but you get the idea). If you choose this path, i can help you with the script.
Found this on Experts Exchange:
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10, Prompt => '', Port >= 3389);
if($t->open("computer.name.or.ip")) {
print "Connect successful\n";
}
else {
print "Could not connect\n";
}
The idea was to attempt a connection and if it can't connect within 'x' amount of seconds, assume it isn't going to work. Gets a bit more complicated if you're trying to see if a login for a specific user works or not, but this should at least get you started.
NOTE: As pointed out in the comments, the original solution left out the RDP port, so I included that in this...

Resources