Start/stop Everything service as a restricted user

General discussion related to "Everything".
Post Reply
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Start/stop Everything service as a restricted user

Post by NotNull »

Just browsed through the To Do list for version 1.5 (wow!) and noticed this:
also need a way to restart the service from a standard user account
and remembered I wrote a script just for that. Thought I posted it, but couldn't find it on the forum (should be somewhere around July 2017).
Anyway, just start the CMD (as an administrator) and press I (install) to be able to start/stop the Everything service as a restricted user. Choosing R (remove) will bring things back to the original state.
Attachments
ManageServiceRestricted.zip
(673 Bytes) Downloaded 458 times
void
Developer
Posts: 16744
Joined: Fri Oct 16, 2009 11:31 pm

Re: Start/stop Everything service as a restricted user

Post by void »

Thanks, added to my notes.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Start/stop Everything service as a restricted user

Post by NotNull »

For your case, the SetServiceObjectSecurity function is probablymore useful.
Example here: https://msdn.microsoft.com/en-us/librar ... s.85).aspx

BTW: I added the extra rights to AU (Authenticated Users) in the script
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Start/stop Everything service as a restricted user

Post by NotNull »

Off-topic:
I post quite a few scripts here for a wide range of purposes. In general, there is no (or minimal) feedback.
Now I wonder: are people actually using these scripts or am I wasting my time?
ovg
Posts: 294
Joined: Thu Oct 27, 2016 7:19 pm

Re: Start/stop Everything service as a restricted user

Post by ovg »

2NotNull

I'm using your script viewtopic.php?f=2&t=6697#p21531
Thank you so much!
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Start/stop Everything service as a restricted user

Post by NotNull »

Good to know. Thanks!

There will be an update for that,btw I only have to find 3 continuous (probably not the best word ..) hours to build that as it takes a lot of time (15-30 minutes per line of code).
I wish I could defragment time somehow ...
ovg
Posts: 294
Joined: Thu Oct 27, 2016 7:19 pm

Re: Start/stop Everything service as a restricted user

Post by ovg »

Thank you! I'll wait! :D
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Start/stop Everything service as a restricted user

Post by Stamimail »

NotNull wrote:Off-topic:
I post quite a few scripts here for a wide range of purposes. In general, there is no (or minimal) feedback.
Now I wonder: are people actually using these scripts or am I wasting my time?
To make more benefit from your scripts, please open a new thread (maybe under Development, plugins Forum) named "NotNull Scripts", and put there the links to their threads in Forums.
In this way, it will be easier to find more of your scripts, especially for those who are looking for extensions for Everything.

Personally I have not found yet something for daily use, but I can tell I'm learning a lot from your scripts, and I keep them in my PC. Those scripts add knowledge and open the mind in the way of using Everything.

You will never know what will be the real fruits will grow from your seeds.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Start/stop Everything service as a restricted user

Post by NotNull »

Warning: this will go even further off-topic ...


The reason I asked was because I don't use those scripts myself either! (*) I don't even have them on my system anymore (if I ever need one of those, I'll rewrite it or download that script from this forum)

There comes a question on the forum or I get some crazy idea and then I build a script to see if I can make it work. Just or fun, just like other people do the crossword puzzles from the paper. A little mental challenge .. And at the end of the day, those people throw their puzzles away.

Difference here is that I post (some of) those scripts on the forum. And that's the part that take the most time: idea and working script takes a couple of minutes; "beautifying" (?) the code, making it more human-friendly and posting it here takes at least 15 minutes, but more likely half an hour.
And that's a waste of time if nobody is using them.
Stamimail wrote: To make more benefit from your scripts, please open a new thread (maybe under Development, plugins Forum) named "NotNull Scripts", and put there the links to their threads in Forums.
In this way, it will be easier to find more of your scripts, especially for those who are looking for extensions for Everything.
I actually thought about this myself too, but for a completely different reason: every time I want to reference one of those topics, I have a hard time finding them (ironic, on a forum of a search utility ;)), and came up with the same solution you suggested. So that will happen on of these days.
Thanks!
Personally I have not found yet something for daily use, but I can tell I'm learning a lot from your scripts, and I keep them in my PC. Those scripts add knowledge and open the mind in the way of using Everything.
Thanks!
Most of them are CMD scripts, because most people (at home) don't have PowerShell execution policies enabled.
CMD is old; better focus on the PowerShell scripts ... (if people ask work-related questions, they get a PowerShell script)
You will never know what will be the real fruits will grow from your seeds.
Wise words ... wise words ...


(*) Exceptions: INJECT script to change INI settings, CompareINI to get all non-default INI settings and the Explorer/file dialog integration @ovg already mentioned
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Start/stop Everything service as a restricted user

Post by Stamimail »

Difference here is that I post (some of) those scripts on the forum. And that's the part that take the most time: idea and working script takes a couple of minutes; "beautifying" (?) the code, making it more human-friendly and posting it here takes at least 15 minutes, but more likely half an hour.
And that's a waste of time if nobody is using them.
In general, I think that it's better to post than not to post.
So if you think you have something to share, share/post it, as it is, without wasting lot of time on changing/improving.
In this way:
1. you are sharing the idea
2. if later, someone ask help in specific implementation, then will come the time to improve things.

If you are quite sure that what you are sharing will be important for a lot of people, then it will be worth some work at the beginning.

More than once, we can see here a new post for an old thread.
Be sure that the thread is read, much more often, than written to it.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Start/stop Everything service as a restricted user

Post by NotNull »

I will think about it..
Thanks for your help!
Stamimail wrote: More than once, we can see here a new post for an old thread.
Be sure that the thread is read, much more often, than written to it.
I'm not sure if I understand this. Do you mean that a lot more people read the messages compared to the people that respond to it?
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Start/stop Everything service as a restricted user

Post by Stamimail »

I'm not sure if I understand this. Do you mean that a lot more people read the messages compared to the people that respond to it?
Yes. A lot more people read the messages, and find answers/benefits without saying "thanks" nor reporting back, compared to the people that give any feedback.
I have no problem with that. It's not ideal, but this is the way things work.
I've never think to stop to say "thanks" or give a feedback each time I found an answer by Google or StackOverflow. The "thanks" simply is there. And reporting back it's usually a matter of time and mood.
One can expect that the number of the responses saying "thanks", will be the same as the number of times the thread has been read. (I even saw in past a forum website that did not allow/enable the links to "download" page before the user commenting "thanks".)
Think about the Doctor in clinic, which always see the people when they are sick. How many people come back to the Doctor saying "I'm good, thanks"?!
The Doctor should know, if people are coming back, it's not good news, because it's telling they are still sick.
However, if people are not coming back, the good Doctor should be pleased. This mean he solved their problem.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Start/stop Everything service as a restricted user

Post by Stamimail »

I didn't understand when this script comes in handy. in which cases?
Can you please add some description for this?
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Start/stop Everything service as a restricted user

Post by NotNull »

Stamimail wrote:I didn't understand when this script comes in handy. in which cases?
Can you please add some description for this?
I mainly posted it because it was on @void's todo-list. Apparently there is some use for that.

I wrote it because it comes in handy when updating Everything. The service has to be stopped for that.
And as I run Everything portable under a restricted useraccount (I run most programs that way), now I can do a SC stop everything, update and SC start Everything
Of course I could easily do a SUDO SC ..., but I forget that from time to time ..
(SUDO is something I wrote to run progrmas / CMD commands elevated)

But this is not a very common situation. Most people will install Everything with the defaults (in Program Files). And I don't thik there was ever an issue with the service so that it required a restart ..

Maybe ask @void why he wants to implement this?
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Start/stop Everything service as a restricted user

Post by NotNull »

FWIW, here is my upddate script; that makes use of the unelevated stop/start of the service.
Double-click to install the neweste version or drag another verion to the script to install that one.

Without some serious editing, this will not run correctly on your system.
But it might give you some ideas ..

Code: Select all

@echo off
setlocal

::	SETTINGS
	set EVERYTHINGDIR=c:\Tools\Everything
	set UNZIP=C:\Tools\7za.exe

::	Stop Everything
	sc.exe stop Everything >nul
	"%EVERYTHINGDIR%\Everything.exe" -quit
	taskkill.exe /IM Everything.exe /T /F 2>nul >nul

::	Detect version to install
	set MOSTRECENT=%1
	if not DEFINED MOSTRECENT (
		for /f "usebackq delims=" %%x in (`dir /b /o:n Everything-1.4.1.*.x64.zip`) Do set MOSTRECENT=%%x
	)

::	Install
	echo Installing %MOSTRECENT%
	rem pause
	"%UNZIP%" e -y -o"%EVERYTHINGDIR%" "%MOSTRECENT%" Everything.exe >nul

::	Start Everything
	sc.exe start Everything >nul
	start "" "%EVERYTHINGDIR%\Everything.exe"
	
EDIT: I should also mention that I download the Everything-1.4.1.xxx.x64.zip files to a folder where this script also resides.
This way I can easily -takes 2 seconds- swap versions (for testing/expreimenting)
Post Reply