MinimServer Forum

Full Version: Automatic Start up using reg key RUN
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I would like to use HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
to automatically run Minimserver when booting the system. But I am unable to execute mserver.jar - I can double click and it runsHuhHuh
(29-09-2016 15:52)Madmax Wrote: [ -> ]I would like to use HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
to automatically run Minimserver when booting the system. But I am unable to execute mserver.jar - I can double click and it runsHuhHuh

Are you OK with having this start when a user logs in (very easy) or do you want it to start when no user is logged in (a bit more work)?
(29-09-2016 21:06)simoncn Wrote: [ -> ]
(29-09-2016 15:52)Madmax Wrote: [ -> ]I would like to use HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
to automatically run Minimserver when booting the system. But I am unable to execute mserver.jar - I can double click and it runsHuhHuh

Are you OK with having this start when a user logs in (very easy) or do you want it to start when no user is logged in (a bit more work)?

Thanks for responding

At boot time as for Windows Defender for example.

HKEY_LOCAL_MACHINE\SOFTWARE|Microsoft\Windows\CurrentVersion\Run

WindowsDefender REG_EXPAND_SZ "%ProgramFiles%\Windows Defender\MSASCuiL.exe"

I have tried various combinations of the following without any luck

MinimServer REG_EXPAND_SZ "%ProgramFiles%\Java\jre1.8.0_101\bin\Javaw.exe -jar %ProgramFiles%\MinimServer\lib\mserver.jar"
Not to worry I did it the easy way - namely I just copied the Minimserver shortcut and pasted it into the Startup folder for all users

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

I could have used the current user Startup folder

C:\Users\Madmax\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
(30-09-2016 03:55)Madmax Wrote: [ -> ]Not to worry I did it the easy way - namely I just copied the Minimserver shortcut and pasted it into the Startup folder for all users

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

I could have used the current user Startup folder

C:\Users\Madmax\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

The second of these should start MinimServer when the user Madmax logs in. Is it the same for the first, or is MinimServer started without a user login?
(30-09-2016 09:17)simoncn Wrote: [ -> ]
(30-09-2016 03:55)Madmax Wrote: [ -> ]Not to worry I did it the easy way - namely I just copied the Minimserver shortcut and pasted it into the Startup folder for all users

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

I could have used the current user Startup folder

C:\Users\Madmax\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

The second of these should start MinimServer when the user Madmax logs in. Is it the same for the first, or is MinimServer started without a user login?

Using the "all Users" startup folder is very unlikely to be a useful choice. MinimServer will then start when any user logs in, but not until a user logs in.
However, the implementation of MinimServer on windows is such that each user has a separate MinimServer configuration, which will need to be set when that user first logs in after MinimServer has been made to start in this way.

In the fairly unlikely event that two (or more) users share a windows computer and every user wants a personal configuration of MinimServer that is only available when they are logged on, then this is ok, but I'd still suggest that in this case, each user should copy the MinimServer shortcut into their personal startup folder.

When a user logs out in windows, all programs that they are running will be stopped by windows - including MinimServer.

If you want MinimServer to run when your windows PC starts up, and to use the same configuration regardless of who (if anyone) is logged on, and to keep running as users log of and on, then you should run MinimServer as a Windows service with restricted rights as I have described before in this forum.
There is another way by putting a script ( .bat file usually) in the following folder
C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup
It might be necessary to run gpedit.msc to enable startup scripts in group policy but usually that's not necessary.
(16-10-2016 20:59)roadster Wrote: [ -> ]There is another way by putting a script ( .bat file usually) in the following folder
C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup
It might be necessary to run gpedit.msc to enable startup scripts in group policy but usually that's not necessary.

This is doing something very different. In windows a "Startup Script" is run in the machine context, i.e. as system. Because MinimServer stores its working files and configuration in the profile of the "user" who is running it, the settings would be saved in the system profile.

System is the most privileged "account" on a windows system, it has more rights than an administrator. So, you really don't want to run anything as system unless it's absolutely essential to do that. Furthermore startup scripts aren't supposed to be for long running processes.

If you want MinimServer to always run on a windows system, you have two reasonably sensible options.

1: The fully supported method: Run MinimServer with your ordinary user credentials, and make sure it starts by copying the shorctut into your personal Startup folder. (Calling this the Startup folder, is somewhat confusing, but that's what Microsoft chose.) If the folder is empty, then it may not appear in your start menu (e.g. on windows 10), but you can find it by typing 'shell:startup' (without the quotes) into the run command.
This assumes that you are always logged on with the same account when your computer is running, which is a very common scenario.
MinimServer is running with the same rights as you, which is more than it needs, but far less than system has.
2: Install MinimServer as a windows service with a restricted virtual service account. I've described a way of doing this here: http://forum1613.minimserver.com/showthr...3#pid21793 .
MinimServer is then running with no more rights than it needs, it can read the programs it needs, and your music library (because you've given it permissions to do that), and it can write to its own profile. The downside is that this is much more complicated, and you need to understand what you are doing. It also isn't a supported configuration, although it's essentially identical to the configuration you'd use on a linux server.

If you have windows system administration experience, then you'll be able to review method 2, and implement it, otherwise stick to method 1.
(17-10-2016 13:39)skeptic Mike Wrote: [ -> ]2: Install MinimServer as a windows service with a restricted virtual service account. I've described a way of doing this here: http://forum1613.minimserver.com/showthr...3#pid21793 .
MinimServer is then running with no more rights than it needs, it can read the programs it needs, and your music library (because you've given it permissions to do that), and it can write to its own profile. The downside is that this is much more complicated, and you need to understand what you are doing. It also isn't a supported configuration, although it's essentially identical to the configuration you'd use on a linux server.

MinimServer does support running from a user account without administrator privilege. Isn't this equivalent to what you are describing? If so, this approach can be regarded as being a supported configuration.
(17-10-2016 14:34)simoncn Wrote: [ -> ]
(17-10-2016 13:39)skeptic Mike Wrote: [ -> ]2: Install MinimServer as a windows service with a restricted virtual service account. I've described a way of doing this here: http://forum1613.minimserver.com/showthr...3#pid21793 .
MinimServer is then running with no more rights than it needs, it can read the programs it needs, and your music library (because you've given it permissions to do that), and it can write to its own profile. The downside is that this is much more complicated, and you need to understand what you are doing. It also isn't a supported configuration, although it's essentially identical to the configuration you'd use on a linux server.

MinimServer does support running from a user account without administrator privilege. Isn't this equivalent to what you are describing? If so, this approach can be regarded as being a supported configuration.

I guess it depends on what you mean by a supported configuration. I wanted to make it clear that someone choosing my suggested method of running MinimServer on windows as a service couldn't expect that you (Simon) would be able to help them if it didn't work, but using the documented technique (my "method 1") did work. i.e. the onus is on that person to assure themselves that they have implemented things correctly, and that they can translate suggestions such as: "delete the lock file found in ..." appropriately.

I tried to make sure that my suggestions corresponded very closely to running as an ordinary unprivileged user, so I'm reasonably confident about them. But to take one example, I suggest the following command line options to the (non-Windowing) java executable:

-jar "C:\Program Files\MinimServer\lib\mserver.jar" --set watch.view=console --noprompt

I found them by looking to see what happened on a linux install, not from the official documentation for MinimServer on windows.

What I wanted to emphasise was that MinimServer is designed (correctly in my view) to run with minimal privileges, and that it can be run as a service in that way on modern versions of windows. I've been a keen advocate of "the principle of least privilege" for years. Running it as system either directly in a startup script, or indirectly as a service run as system is a really bad idea, that should be strongly discouraged.
Pages: 1 2
Reference URL's