Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows 10 - Autostart MinimServer with Task Scheduler
17-03-2017, 23:02 (This post was last modified: 17-03-2017 23:03 by kaycee.)
Post: #1
Windows 10 - Autostart MinimServer with Task Scheduler
I just wanted to share this so it may be useful for others looking for a similar solution.

I am running Minimserver on a Windows 10 PC. I was looking for a way to start Minimserver automatically instead of logging in and starting Minimserver manually each time PC reboots after Windows update. I searched the forum and found two options. One was to add it to Startup folder which will start Minimserver after I login (not a major improvement) or install it as a service that can start automatically without logging in.

Before trying the service option I wanted to see whether there is a simpler option using "Task Scheduler" under Control Panel. After a few trail and errors I got it to working the way I wanted. Whenever the system reboots, Windows runs the task at startup and starts Minimserver.

Only downside is that there is no GUI if you want to login and play with Minimserver as there is no icon on system tray. This may be because it runs under a separate cmd window. I tried Minimwatch on the same PC but it did not work. Later I saw in Monitoring and Control section that this is by design.

Thanks!
Find all posts by this user
Quote this message in a reply
18-03-2017, 00:11
Post: #2
RE: Windows 10 - Autostart MinimServer with Task Scheduler
MinimWatch should show a tray icon if MinimServer isn't showing its own tray icon. Can you say in more detail what you did in Task Scheduler?
Find all posts by this user
Quote this message in a reply
18-03-2017, 04:44 (This post was last modified: 18-03-2017 04:44 by kaycee.)
Post: #3
RE: Windows 10 - Autostart MinimServer with Task Scheduler
(18-03-2017 00:11)simoncn Wrote:  MinimWatch should show a tray icon if MinimServer isn't showing its own tray icon. Can you say in more detail what you did in Task Scheduler?

Hi Simon,

What I did in Task Scheduler was just to schedule a new task that will run "java -jar C:\Program Files\MinimServer\lib\mserver.jar" when PC boots and start in C:\Program Files\MinimServer\lib. In Task Configuration I chose the option to start it whether user is logged in or not and to trigger it at System Startup.

If I install Minimwatch on the same PC and start it, it does show up in tray icon. But it does not see the Minimserver running on the same PC (top menu items like Rescan etc are greyed out). I saw "Note: Instances of MinimServer running on the same computer aren't displayed as MinimWatch icons. This would be confusing, because they're already displayed as MinimServer icons". May be that is the reason Minimwatch does not see the Minimserver running on the same PC?


Thanks
Find all posts by this user
Quote this message in a reply
18-03-2017, 17:44
Post: #4
RE: Windows 10 - Autostart MinimServer with Task Scheduler
When MinimWatch and MinimServer are running on the same machine under the same username, MinimWatch queries MinimServer to find out if MinimServer has a tray icon displayed. If MinimServer reports that it does have a tray icon displayed, MinimWatch doesn't display its own tray icon for that MinimServer instance. If MinimServer reports that it doesn't have a tray icon displayed, MinimWatch does display its own tray icon for that MinimServer instance.

This works well in most cases but unfortunately it isn't working when you start MinimServer on Windows during system startup and then login as the MinimServer username. For some reason, Windows is telling MinimServer that there is a tray icon even though there is no such icon displayed. This means that MinimServer is telling MinimWatch that there is a tray icon and MinimWatch is therefore not displaying its own tray icon.

You can work around this problem by adding the following option to your startup task comand:

--set watch.view=log

This tells MinimServer not to attempt to create a tray icon. With this setting, MinimWatch will display a tray icon for the local MinimServer instance.
Find all posts by this user
Quote this message in a reply
18-03-2017, 17:54 (This post was last modified: 23-03-2017 00:44 by skeptic Mike.)
Post: #5
RE: Windows 10 - Autostart MinimServer with Task Scheduler
(edited for clarity - mike)
(18-03-2017 04:44)kaycee Wrote:  
(18-03-2017 00:11)simoncn Wrote:  MinimWatch should show a tray icon if MinimServer isn't showing its own tray icon. Can you say in more detail what you did in Task Scheduler?

Hi Simon,

What I did in Task Scheduler was just to schedule a new task that will run "java -jar C:\Program Files\MinimServer\lib\mserver.jar" when PC boots and start in C:\Program Files\MinimServer\lib. In Task Configuration I chose the option to start it whether user is logged in or not and to trigger it at System Startup.

If I install Minimwatch on the same PC and start it, it does show up in tray icon. But it does not see the Minimserver running on the same PC (top menu items like Rescan etc are greyed out). I saw "Note: Instances of MinimServer running on the same computer aren't displayed as MinimWatch icons. This would be confusing, because they're already displayed as MinimServer icons". May be that is the reason Minimwatch does not see the Minimserver running on the same PC?


Thanks

This is an interesting idea, although I have some reservations about it.

If you're starting MinimServer in this way, then it should be running the necessary code to produce the MinimServer icon in the system tray. However, you won't be able to see it when you logon because it can't have set itself to appear in the system tray of a non-existent windows explorer. More generally, logging on as a batch service, which is what you are doing, doesn't expect to create any GUI.
The information I gave about running MinimService with a virtual service account (http://forum1613.minimserver.com/showthr...p?tid=3217) shows a command line that I inferred from the linux set up. This was chosen to stop any attempt to create the invisible GUI. Subsequently, in page 2 of http://forum1613.minimserver.com/showthr...p?tid=3607 Simon said that this wasn't supported, but that the option --set watch.view=log would be supported.

I can confirm that using the service technique I described does allow MinimWatch to run and control the MinimServer instance on the same PC.

Simon has confirmed that if you add the option to suppress the GUI, then MinimWatch would show the local MinimService.

However, I wouldn't recommend running MinimServer in this way. If you are using a conventional account (member of administrators), then you will have the right to logon as a batch service, which you need for this to work, but then you will be running MinimServer with full administrative rights. i.e. more rights than if you started it using the startup folder in your windows profile. This isn't desirable from a security point of view. If you are using Windows 10 Pro, then it is fairly straightforward to grant an ordinary (unprivileged) user account the necessary right, (using secpol.msc), but if you have Windows 10 Home, then it is very awkward - the only way that might work, other than writing your own program, is to use ntrights.exe from the Server 2003 resource kit.

Although it was fiddly to set up, I've been happy with the Service technique I described, and it has been reliable. Windows has automatically updated itself several times, and the service just runs.
Find all posts by this user
Quote this message in a reply
20-03-2017, 13:40
Post: #6
RE: Windows 10 - Autostart MinimServer with Task Scheduler
There is another way to start an application or run any batch file on startup. Simply put the batch file or shortcut in this location
C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup\
There can also be a shutdown folder.

Minimwatch does require a user interface so it can be started easily from the users startup folder
c:\users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\startup
Find all posts by this user
Quote this message in a reply
23-03-2017, 00:36
Post: #7
RE: Windows 10 - Autostart MinimServer with Task Scheduler
(20-03-2017 13:40)roadster Wrote:  There is another way to start an application or run any batch file on startup. Simply put the batch file or shortcut in this location
C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup\
There can also be a shutdown folder.

Minimwatch does require a user interface so it can be started easily from the users startup folder
c:\users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\startup

Using a startup script means that you are running MinimServer as system which is a highly priivileged account. Simon has pointed out that it is designed to be run by an unprivileged account, so this isn't a good way to run it. Putting the MinimServer shortcut in the users startup folder is ok, and is your best bet if you want to avoid the complications of the virtual service account. I'll have another look at the task scheduler method, but it will only be equivalent if the account isn't a member of administrators.

Any method other than the shortcut in the users startup folder should use the command line option that Simon mentioned to suppress the tray icon.
Find all posts by this user
Quote this message in a reply
26-03-2017, 06:16
Post: #8
RE: Windows 10 - Autostart MinimServer with Task Scheduler
Hi Simon,

Thanks. After adding --set watch.view=log, Minimwatch sees Minimserver running on the same machine.

Mike:

In the Task Scheduler you can select the user id under which the task will be run at startup.

Kaycee
Find all posts by this user
Quote this message in a reply
24-04-2017, 18:14
Post: #9
RE: Windows 10 - Autostart MinimServer with Task Scheduler
(26-03-2017 06:16)kaycee Wrote:  Hi Simon,

Thanks. After adding --set watch.view=log, Minimwatch sees Minimserver running on the same machine.

Mike:

In the Task Scheduler you can select the user id under which the task will be run at startup.

Kaycee

Thanks Mike. I followed your instructions to set it up as a service and it works great.

Kaycee
Find all posts by this user
Quote this message in a reply
01-08-2020, 16:52 (This post was last modified: 01-08-2020 16:55 by janamdo.)
Post: #10
RE: Windows 10 - Autostart MinimServer with Task Scheduler
Ok, i read this, but no idea yet how to get minimserver automatically startup in windows 10 64 bit pro when i startup windows 10.
How to do this?
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)