Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Start-Service return immediately

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 12-29-2006   #1 (permalink)
Jibbers42
Guest


 

Start-Service return immediately

I'm using powershell in VS2005 pre and post build events to start and stop
the windows service I'm working on. I need the start-service command to
return right away and not wait for the service to start before returning.
It's causing a chicken and egg situation. Anyone know how to do this?

Here are the details for anyone interested:
I have a script that is run on pre-build event to stop the service and
record in a scratch file whether the service was running or not. On
post-build I have a script that runs to check the scratch file and start the
service again if it was running before the rebuild.
I'm using Debugger.Launch; Dubugger.Break; in the service startup code so I
can jump in and debug the startup logic. Here is where the problem is...
the powershell script will not return until the service finishes startup code
and the VS2005 IDE won't let me jump into the starup code to debug in the
currently open instance becuase it is busy running a post-build event. If
the script would return right away and not wait for the service to finish
starting then I think I'd be fine.

Thanks for the help

My System SpecsSystem Spec
Old 01-03-2007   #2 (permalink)
/\/\o\/\/ [MVP]
Guest


 

RE: Start-Service return immediately

can you try this ?

powerShell {start-service service}

or this

cmd /c start /b powerShell {start-service wmi}

greetings /\/\o\/\/


"Jibbers42" wrote:

> I'm using powershell in VS2005 pre and post build events to start and stop
> the windows service I'm working on. I need the start-service command to
> return right away and not wait for the service to start before returning.
> It's causing a chicken and egg situation. Anyone know how to do this?
>
> Here are the details for anyone interested:
> I have a script that is run on pre-build event to stop the service and
> record in a scratch file whether the service was running or not. On
> post-build I have a script that runs to check the scratch file and start the
> service again if it was running before the rebuild.
> I'm using Debugger.Launch; Dubugger.Break; in the service startup code so I
> can jump in and debug the startup logic. Here is where the problem is...
> the powershell script will not return until the service finishes startup code
> and the VS2005 IDE won't let me jump into the starup code to debug in the
> currently open instance becuase it is busy running a post-build event. If
> the script would return right away and not wait for the service to finish
> starting then I think I'd be fine.
>
> Thanks for the help

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with a Service that Fails to Start (Bonjour Service) Stéphane Bergeron Vista General 2 07-11-2008 06:21 PM
WLAN AutoConfig won't start | Windows Wireless Service won't start.... wheatln2 Network & Internet 4 06-14-2008 03:12 PM
How is it possible to execute start-service and stop-service through a Web-interface? Alexander Vasilevsky PowerShell 7 11-15-2007 08:29 PM
Launch Process & return to prompt immediately Clint Bergman PowerShell 3 04-28-2007 12:13 PM
Vista Event Notification service fails, logs user off immediately Keith Patrick Vista security 0 03-29-2007 10:49 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51