Sign in to follow this  
Followers 0
m16318

Run a script in a Virtual Desktop

9 posts in this topic

Is it possible to run a script in a virtual desktop if users are interacting with a pc.

For example: We have desktop 1 and 2. Is it possible to run script on desktop 2 while desktop 1 is in use?

I have already tried, but autoit always opens a program or process on desktop 1.

Thanks! :-)

Share this post


Link to post
Share on other sites



yes, find out which coordinates are used when app run's on desktop 2. But why you named the 2. Desktop virtuell? 

Share this post


Link to post
Share on other sites

If your running a virtual windows environment, it should be easy enough to run your script from the virtual environment itself and it can run independent.

If your running something else, or for some reason have to run from the host machine and want to interact only with mouse clicks and keyboard commands, that is not going to play well with a user trying to use the host computer at the same time your trying to automate something in the virtual environment. 

 

Can you give more detail as to what your setup is, what are you virtualizing, what are you trying to accomplish in that environment via scripting? 

Share this post


Link to post
Share on other sites

You can also use paexec, or scheduled task, on your vm/remote session, to have the script run behind the desktop on session 0.

paexec also has the added ability to copy your compiled script to the other session, and then execute it.

1 person likes this

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Thanks for the suggestions.

Yes, I have already tested my script with autologon feature on my remote virtual machine. In that case the script runs fine independently in the background session. At the moment I need to know how to run the script independently on a Virtual desktop 2 when user is interacting with Virtual desktop 1, so I think paexec won't help me here. At the moment I am conducting tests with VirtualWin application. What is happening now, is if I run the script on vd2 the process (window) will open on active virtual destop (vd1).

 

Share this post


Link to post
Share on other sites

My suggestions can be used for whatever the scenario is.  I can't specifically help you, because I have no idea what you are talking about.

You can initiate a scheduled task remotely (i.e. you initiate the remote task from your local station) on one of your remote desktops, which can be configured to run on the local users session, or the local service session...

If you want to initiate the script locally, you can use paexec to execute the script on the remote user session, or the remote service session...

 

If one of those is not your scenario, then define it.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

On 3/9/2016 at 3:12 AM, jdelaney said:

You can also use paexec, or scheduled task, on your vm/remote session, to have the script run behind the desktop on session 0.

paexec also has the added ability to copy your compiled script to the other session, and then execute it.

Ok. how can I run the script in session 0 properly?

I am now running my script in session 0 as a service, everything works well until it reaches windows security pop up. Then script stops it can't enter username and password.

The script runs fine on a normal session.

And also how would I use  paexec  to copy and execute my script in session 0? Would that make any difference since I am already able to run the script in session 0 but with limitations.

Any suggestion would be helpful :-)

Edited by m16318

Share this post


Link to post
Share on other sites

Use a scheduled task.  Set it to "Run whether user is logged on or not," store the credentials with it, and check "Run with highest privileges."  When the script runs, you will not be prompted for a username and password by UAC.  Just be sure to store the script where the user running task has permissions to access it.  Also, be sure to check "Allow task to be run on demand" on the Settings tab.  This will allow you to execute task when ever you like.  I have multiple scripts running on my VM Servers this way.  

 

Adam

 

Share this post


Link to post
Share on other sites

AdamUL explained the scheduled task.  You can do paexec /? or -help, or something to get the params...there is one param to run with elevated privileges, another to copy the file over.  By default, it runs on session 0, but you can specify another if needed, or -I for interactive.  I don't have it here, on my home comp, so couldn't tell you the exact params, but you can google it.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0