Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know there is this sc.exe where you can add and set Windows service dependencies, but I was wondering if the same thing can be done using Powershell.

share|improve this question
up vote 3 down vote accepted

From the documentation: not through the Set-Service cmdlet.

However the Change method of Win32_Service allows dependencies to be specified: so WMI can do it.

share|improve this answer
    
Ok. I've never scripted through WMI before. But if powershell can't do it, then I guess I'm left with either sc.exe or WMI. – Skaue Jun 22 '11 at 8:30

No it is definitely possible, see DependsOn parameter on New-Service

share|improve this answer
    
Why the down vote on this? It is correct. – jscott Feb 27 '14 at 13:16
    
It's correct for new services created by New-Service, but not for changing existing services with Set-Service. – Jonathan Feb 28 at 14:26

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.