Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I wrote a batch file, which creates multiple folders und subfolders in the current directory. The group permission of one folder is also changed. This works on my local workstation with administrator privileges, but it doesn't work on the server, because I don't have the sufficient rights.

This batch should also be used by other non-administrator users, who don't have the right to change the permissions of folders and it's no option to give them this right.

After reading this comment, the solution seems to be obvious:

  1. Write a VBScript, which changes the permission of a given folder (folder-name is the argument)
  2. Run the VBScript as Windows Service (run as administrator)
  3. And change the batch so, that the Windows Service is called (passing the folder as argument)

My questions are: How can the batch send a command to the windows service? And in what way must the service be implemented, to receive this command and process it?

share|improve this question
add comment

2 Answers 2

You can check RunAsService which should be able to start one or more applications as a Windows Service.

You might want to check out this too.

share|improve this answer
    
Thanks. Yes, this is a part of the problem. My question is aiming more to the communication between client (batch) and service. How can the batch send a command to the windows service? And in what way must the service be implemented, to receive this command and process it? I'll edit the question. –  Christian May 20 '12 at 12:00
add comment

The sc start command allows you to specify options which will be passed to the service's ServiceMain function.

I don't know offhand if any of the existing "run an application as a service" solutions will pass these arguments to the application, but it shouldn't be too hard to implement.

Make sure you validate the folder name carefully. You don't want someone being able to reset permissions on c:\folders\..\windows\system32, for example.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.