Solved

i try to run a .bat file with a specific user even if restarts,log off with nssm,help!

Posted on 2016-11-19
13
59 Views
Last Modified: 2016-11-21
I want to run Myscript.bat 24h/24h only in my acc. as long as the RDP server power is UP!!  even if the rdp is restarted ,logged off etc
this is the tool i try to use: https://nssm.cc/


- Look 1'st snapshot
so if i check Local System account and also Allow service interact with Desktop,then if someone restarts our public RDP ''Myscript.bat'' also restarts and running in ''ALL local users''.so if we are 5 administrators that means ''script.bat'' it is opening for ALL 5 and i don't want that,I want to run only in my account
EasyCapture1.jpg
- Look 2'st snapshot and also the 2'nd option:
Ok so if i want to run''only my account'' i check:
This account

Open in new window

,i do that and everything works fine with 1 exception, NO DEKSTOP INTERRACTION (that means Myscript.bat runs in backround only,i can't see it running in Command Prompt
EasyCapture2.jpg

I do not know how to run ''This account'' and also Interract with Desktop???
anyone knowshow to proceed?does anyone have a solution?
thank you
0
Comment
Question by:john lambert
13 Comments
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
ID: 41894311
instead of using a service set a scheduled task to run on your logon
0
 

Author Comment

by:john lambert
ID: 41894344
are u sure will workin?for example rdp restarts so my acc. keeped to be logged off....
0
 
LVL 5

Expert Comment

by:Austin Texas
ID: 41894561
If you want the scheduled task to run when you are logged off, select the radio button labeled Run whether user is logged on or not. However, if this radio button is selected, tasks will not run interactively so you will not see the script run.  To make a task run interactively so you can see it run, select the Run only when user is logged on radio button, but you will have to be logged in.
0
 

Author Comment

by:john lambert
ID: 41894571
hehehe yes?that means i still have the same problem!!
0
 
LVL 5

Expert Comment

by:Austin Texas
ID: 41894576
Can you please post the script so we can understand what you are trying to do?
0
 

Author Comment

by:john lambert
ID: 41894579
it's a bat script...i want run''interactively'' in command prompt  even if someone restarts or log off my acc. as long as the RDP server power is UP!!

ur solution runs well and nssm.exe runs weel but the ONLY and SINGLE problm is that they don't run interactively
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 5

Accepted Solution

by:
Austin Texas earned 500 total points
ID: 41894839
0
 

Author Comment

by:john lambert
ID: 41894995
Austin Texas soon i will try i will tell you if works or not,i want to run that .bat file o.ly inside my session
0
 

Author Closing Comment

by:john lambert
ID: 41895416
very nice very interesting method, thank you
0
 

Author Comment

by:john lambert
ID: 41895704
many windows 7 blah blah versions some of them dones't allow more sessions others have UAC enabled and ask for credentials...all the time so i think this method is not the best! ufff
0
 

Author Comment

by:john lambert
ID: 41895744
ok i let run ''NSSM.EXE''  in backround and when i logged on ,can i it make visible?
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 41896969
Modify the bat so it writes a log (for ex on your desktop, myscript.log).

Then you don't need it to be visible. You can read the log.

HTH,
Dan
0
 

Author Comment

by:john lambert
ID: 41897089
i have a simple output.txt when finds a Hit stops and writte there....Save the output.txt on my tool path
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Remote Access to Outlook 5 33
Steps to follow for Maintenance of Servers 4 50
How can I save all open docs into a given folder 12 83
DHCP Server 14 61
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now