Windows XP and Services

jfall

Diamond Member
Oct 31, 2000
5,975
2
0
Does anyone know if it is possible for me to run a service for a certian user on my computer? Basically what I want to do is Run VNC as a service, but only when my account is logged in, not other users on this computer. Is it possible for me to run a service for just me so it won't run for any other person that logs in?
 

c0rv1d43

Senior member
Oct 1, 2001
737
0
0
Well, sorta, yes and no. If you have WinXP Pro this will be easier, or at least you'll have more leeway in the way you deal with it. Basically, you need to set up the system so that your user profile has permissions that others don't. Since services (automatic ones, that is) load before anyone logs in, they tend to run or not run. A user can turn a service on manually, of course. Sometimes this may be accomplished by running an application that calls for the service. The default user profile in WinXP is an admin account. Can you demote the other users of the machine to the limited account status? (It's pretty limited.) This is where having WinXP Pro could be much nicer than having to do this with Home Edition. Pro includes the group policy editor. You can make the other users a member of a group which doesn't get to control VNC. Still, if they're all full admin users, they'll be able to change their status and still get access to the application. So you still wind up having to "demote" them if you really need to lock them out.

If the machine logs onto a domain, well then it's a whole other ballgame. The domain admin can do whatever is needed in this respect.

All my work with WinXP so far has been for and with people who must have at least local admin privs, so I've been curious to see how issues like this would be resolved.

- Collin
 

jfall

Diamond Member
Oct 31, 2000
5,975
2
0
Thanks for the informative response!

I have Windows XP Pro and I am the admin on this computer. Basically the computer has three users, my brother, sister and I. VNC is already running as a service, but it runs as a service for every user. This computer does not connect to any sort of a domain, it's all local.. just a regular home computer. I want VNC to run as a service for my brother and my sister, but not for me. Seeing how I am the admin, that might not be possible?
 

c0rv1d43

Senior member
Oct 1, 2001
737
0
0
I'm afraid I'm not quite getting what you want to do. If you tell us exactly what you wish to do, or what you wish your brother and sister to do, with VNC, maybe someone will have a solid idea of how to help you. I'm a bit confused by what I perceive to be a difference between the way you stated your situation in your first message and the way that you stated it in the subsequent message. So I'm not sure who it is that you wish to have control over VNC and how you wish to have it used. Who is accessing what and from where? This might be doable. I haven't used VNC for quite some time, so I'm hoping someone who's familiar with recent versions will join in. There may be security features within VNC itself that will serve your purpose.

- Collin
 

jfall

Diamond Member
Oct 31, 2000
5,975
2
0
Sorry, might of got a bit confused :) VNC itself has nothing to do with what I am trying to do. All I am trying to do is have a service run (which in this case is VNC but could be any other service) only if my brother or sister is logged in. I do not want the service to run when I am logged into my account. So, my brother logs in, VNC service starts. My sister logs in, VNC service starts. I log in, VNC service does not start. I really apriciate the help so far, like I said before, this may not even be possible.
 

c0rv1d43

Senior member
Oct 1, 2001
737
0
0
Hmmm. I was making this far too hard in my mind. I think that the way you accomplish this will depend somewhat upon the process you're trying to start for your brother and sister, and whether or not, and the degree to which, the initiation of the process needs to be "invisible" and / or inaccessible to them. The easy (and somewhat inelegant) method of doing this would be to set a script or batch file that starts the process to run at startup for your brother's and sister's profiles but not for yours. It could obviously be done from the registry as well. I'd have to know more about VNC in its present incarnation to be more specific, but this should be a trivial thing to do, as long as VNC is not cantankerous about how and when it's started. I suspect that it's not.

Since you use VNC as an example, how do you start VNC as it is? The shortcut's "Target" field should give you most or all of the information you need for constructing a batch file that would be placed in the Startup group of each of the profiles in which you wish to run VNC. Does this help?

- Collin
 

jfall

Diamond Member
Oct 31, 2000
5,975
2
0
well, I already know that I could make a batch file that could run vnc on startup.. but it wouldn't be running as a service, unless there is a switch that you can run with it to make it run as a service? I am going to play around with it and see what I can find out, like I said.. i'm not even sure if this is possible. Thanks for all your help.
 

c0rv1d43

Senior member
Oct 1, 2001
737
0
0
Yes, that's why I indicated that whether and / or how you could start a process as a service would depend largely upon the process itself. As I said earlier, I haven't used VNC in quite some time, and I never tried to use it in precisely this manner before. I would assume that you could find out about command line switches from its documentation. You also seemed to be hinting that you might need to use this technique for other processes besides VNC. Given my lack of recent exposure to VNC and the information at hand I was trying to present you with generalized information.

If VNC can't provide this function in and of itself you may still be able to accomplish what you wish by doing a little searching for information. Besides the venerable instsrv.exe and srvany.exe tools from the NT and Windows 2000 Servier Resource Kits, a quick search I did revealed the following links to third party tools for this purpose:

http://www.prismmicrosys.com/atyourservice/atyourservice-index.htm

http://www.firedaemon.com/

http://www.activeplus.com/

Microsoft has this article

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q137890

for general information on how to create user-defined services in Windows NT and 2000. I imagine that the same procedures should work for Windows XP.

If you wish to stick with Microsoft tools, I think srvany.exe and instsrv.exe may be available for download at the Microsoft ftp site.

Good luck!

- Collin

 

mobly99

Senior member
Apr 27, 2001
260
0
0
OK, here we go...

First we need to know the name of the service so go to a command prompt and type "net start" to get the full name of the running services (not sure what VNC is running as).

once you have this, then we can create a logon and a logoff script for your account.

in the logon script you will put the following command:
net stop "the full name of the service from above in quotes"

in the logoff script you will put the following command:
net start "the full name of the service from above in quotes"

Since the service is allready automaticlly starting on bootup, this should fix you up - when you logon VNC will terminate, when you log out VNC will start.

The bigger question is why do you even need VNC running, you already have Terminal Services/RDP running in XP Pro.

-Dave
 

jfall

Diamond Member
Oct 31, 2000
5,975
2
0
c0rv1d43: Thanks for all the information, that was very helpful!

mobly99: I definitally understand what you are saying, however the only small thing I am confused about is what you mean by Login/Logoff scripts? Is there a certian file I edit, or do I have to create something from scratch or what?
 

jfall

Diamond Member
Oct 31, 2000
5,975
2
0
Ok, what I have done so far is made login.bat which has the following in it:

@echo off
net stop "VNC Server"

I put that in my startup folder. So when I login to my account, the VNC server stops. What I have to do now though, is find out how to make/run a Logoff script that will start VNC again with net start "VNC Server". Any information would be helpful. Thanks.