i am wondering if it is possible to run powershell scripts as windows
service?
embedding my *.ps1 script in a batch file and using instsrv/srvany
allows me to start up my *.ps1 script but when i stop the service, it
seems to stop the running *.bat but not the contained *.ps1
Application...
Any hints?
you would need to start powershell as the service and put in the script you
want to run as a parameter
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk
--
Brandon Shell
---------------
Stop by my blog some time :)
http://www.bsonposh.com/
Try the "Search of Powershell Blogs"
--------------------------------------
<tobia...@gmail.com> wrote in message
news:1170949835.5...@q2g2000cwa.googlegroups.com...
If he has this in the batch it should block and powershell should terminate
when cmd.exe is killed.
powershell -command script.ps1
Maybe he can post the script
--
Brandon Shell
---------------
Stop by my blog some time :)
http://www.bsonposh.com/
Try the "Search of Powershell Blogs"
--------------------------------------
"RichS" <Ri...@discussions.microsoft.com> wrote in message
news:DABF7B12-F851-4514...@microsoft.com...
Hi all,
i started my test.ps1 in a run.bat like
Powershell C:\test.ps1
With this run.bat i "created" a Windows Service with instsrv and
srvany... the usual way.
I solved the problem of "stopping" the service including the
powershell script by using
"powershell C:\test.ps1"
in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aaaa
\Parameters "Application" Key
--> now when i stop the Service (here: aaaa) , also the powershell
script seems to be stopped.
So the solution is not to use the "integration" of a powershell script
in a batch file when it should be run as a windows service.
Just create your Service with "instsrv" and "srvany" the usual way and
use "powershell myscript.ps1" in the registry...
--
Brandon Shell
---------------
Stop by my blog some time :)
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------
<tobia...@gmail.com> wrote in message
news:1170955656.9...@q2g2000cwa.googlegroups.com...