TechTalkz.com Logo Ask the Experts!

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Microsoft > Microsoft Windows Powershell

when run powershell script as windows service ,powershell fail

Microsoft Windows Powershell

 
 
Thread Tools Display Modes
Unread 03-02-2008, 01:35 PM   #1
powershell fail on winodws 2008
Guest
 
Posts: n/a
when run powershell script as windows service ,powershell fail

On windows 2008 ,run powershell script by windows serivice application ,but
this script always failed due to the following .Net runtime error

..NET Runtime version 2.0.50727.1433 - The Win32 internal error "Access is
denied" 0x5 occurred when retrieving handle for active console output buffer.
Please contact Microsoft Support Services.

Another thing I need to get the result of powershell script by redirect
stdout/stderr of
powershell ,so I create powershell process without specified creation flags.


Sponsored Links
 
Unread 03-02-2008, 01:35 PM   #2
Marco Shaw [MVP]
Guest
 
Posts: n/a
Re: when run powershell script as windows service ,powershell fail

powershell fail on winodws 2008 wrote:
> On windows 2008 ,run powershell script by windows serivice application ,but
> this script always failed due to the following .Net runtime error
>
> .NET Runtime version 2.0.50727.1433 - The Win32 internal error "Access is
> denied" 0x5 occurred when retrieving handle for active console output buffer.
> Please contact Microsoft Support Services.
>
> Another thing I need to get the result of powershell script by redirect
> stdout/stderr of
> powershell ,so I create powershell process without specified creation flags.
>


You're trying to run a PowerShell script as a service?

Can you detail exactly what you're trying to do?

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
 
Unread 03-02-2008, 01:37 PM   #3
powershell fail on winodws 2008
Guest
 
Posts: n/a
RE: when run powershell script as windows service ,powershell fail



"powershell fail on winodws 2008" wrote:

> On windows 2008 ,run powershell script by windows serivice application ,but
> this script always failed due to the following .Net runtime error
>
> .NET Runtime version 2.0.50727.1433 - The Win32 internal error "Access is
> denied" 0x5 occurred when retrieving handle for active console output buffer.
> Please contact Microsoft Support Services.
>
> Another thing I need to get the result of powershell script by redirect
> stdout/stderr of
> powershell ,so I create powershell process without specified creation flags.
>

 
Unread 03-02-2008, 01:37 PM   #4
powershell fail on winodws 2008
Guest
 
Posts: n/a
Re: when run powershell script as windows service ,powershell fai


I have windows services application ,which run script periodically . if this
srcipt is
common batch ,no problem .but if this script is wrotten in powershell and
with
externsion name ".ps1" , the script cann't be done and from applicataion
event
log ,I found some .Net runtime error


I wan to know from .Net runtime error , can you tell me which win32API
failed ,or
can you tell me what powershell is try to doing at that point

"Marco Shaw [MVP]" wrote:

> powershell fail on winodws 2008 wrote:
> > On windows 2008 ,run powershell script by windows serivice application ,but
> > this script always failed due to the following .Net runtime error
> >
> > .NET Runtime version 2.0.50727.1433 - The Win32 internal error "Access is
> > denied" 0x5 occurred when retrieving handle for active console output buffer.
> > Please contact Microsoft Support Services.
> >
> > Another thing I need to get the result of powershell script by redirect
> > stdout/stderr of
> > powershell ,so I create powershell process without specified creation flags.
> >

>
> You're trying to run a PowerShell script as a service?
>
> Can you detail exactly what you're trying to do?
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
>

 
Unread 03-02-2008, 01:38 PM   #5
Shay Levi
Guest
 
Posts: n/a
Re: when run powershell script as windows service ,powershell fai

What's the command line you're service is running to invoke the script?

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com

> I have windows services application ,which run script periodically .
> if this
> srcipt is
> common batch ,no problem .but if this script is wrotten in powershell
> and
> with
> externsion name ".ps1" , the script cann't be done and from
> applicataion event log ,I found some .Net runtime error
>
> I wan to know from .Net runtime error , can you tell me which
> win32API failed ,or can you tell me what powershell is try to doing at
> that point
>
> "Marco Shaw [MVP]" wrote:
>
>> powershell fail on winodws 2008 wrote:
>>
>>> On windows 2008 ,run powershell script by windows serivice
>>> application ,but this script always failed due to the following .Net
>>> runtime error
>>>
>>> .NET Runtime version 2.0.50727.1433 - The Win32 internal error
>>> "Access is denied" 0x5 occurred when retrieving handle for active
>>> console output buffer. Please contact Microsoft Support Services.
>>>
>>> Another thing I need to get the result of powershell script by
>>> redirect stdout/stderr of powershell ,so I create powershell process
>>> without specified creation flags.
>>>

>> You're trying to run a PowerShell script as a service?
>>
>> Can you detail exactly what you're trying to do?
>>
>> Marco
>>
>> --
>> Microsoft MVP - Windows PowerShell
>> http://www.microsoft.com/mvp
>> PowerGadgets MVP
>> http://www.powergadgets.com/mvp
>> Blog:
>> http://marcoshaw.blogspot.com



 
Unread 03-02-2008, 01:38 PM   #6
Marco Shaw [MVP]
Guest
 
Posts: n/a
Re: when run powershell script as windows service ,powershell fai

powershell fail on winodws 2008 wrote:
> I have windows services application ,which run script periodically . if this
> srcipt is
> common batch ,no problem .but if this script is wrotten in powershell and
> with
> externsion name ".ps1" , the script cann't be done and from applicataion
> event
> log ,I found some .Net runtime error


OK, built-in, you cannot simply run a .ps1 file by double-clicking on it
for example.

Just for fun, wrap the PowerShell commands in a VBScript script
following this example:
http://blog.sapien.com/current/2006/...owershell.html
 
Unread 03-02-2008, 01:38 PM   #7
Karl Prosser[MVP]
Guest
 
Posts: n/a
Re: when run powershell script as windows service ,powershell fail

Sponsored Links
Powershell.exe interacts with the console intimately, maybe .bat's don't
neccisarily have to. However i'm sure you could make a small application
yourself that hosts the powershell engine and runs scripts in the service.
-Karl

Marco Shaw [MVP] wrote:
> powershell fail on winodws 2008 wrote:
>> On windows 2008 ,run powershell script by windows serivice application
>> ,but this script always failed due to the following .Net runtime error
>> .NET Runtime version 2.0.50727.1433 - The Win32 internal error "Access
>> is denied" 0x5 occurred when retrieving handle for active console
>> output buffer. Please contact Microsoft Support Services.
>>
>> Another thing I need to get the result of powershell script by
>> redirect stdout/stderr of powershell ,so I create powershell process
>> without specified creation flags.
>>

>
> You're trying to run a PowerShell script as a service?
>
> Can you detail exactly what you're trying to do?
>
> Marco
>


Sponsored Links
 
 

Thread Tools
Display Modes



< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT. The time now is 06:00 PM.


vBulletin, Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © 2005-2016, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional