Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - when run powershell script as windows service ,powershell fail

Reply
 
Old 01-15-2008   #1 (permalink)
powershell fail on winodws 2008


 
 

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.


My System SpecsSystem Spec
Old 01-15-2008   #2 (permalink)
Marco Shaw [MVP]


 
 

Re: when run powershell script as windows service ,powershell fail

powershell fail on winodws 2008 wrote:
Quote:

> 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
My System SpecsSystem Spec
Old 01-15-2008   #3 (permalink)
powershell fail on winodws 2008


 
 

RE: when run powershell script as windows service ,powershell fail



"powershell fail on winodws 2008" wrote:
Quote:

> 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.
>
My System SpecsSystem Spec
Old 01-15-2008   #4 (permalink)
powershell fail on winodws 2008


 
 

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:
Quote:

> powershell fail on winodws 2008 wrote:
Quote:

> > 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
>
My System SpecsSystem Spec
Old 01-15-2008   #5 (permalink)
Shay Levi


 
 

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
Quote:

> 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:
>
Quote:

>> powershell fail on winodws 2008 wrote:
>>
Quote:

>>> 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

My System SpecsSystem Spec
Old 01-15-2008   #6 (permalink)
Marco Shaw [MVP]


 
 

Re: when run powershell script as windows service ,powershell fai

powershell fail on winodws 2008 wrote:
Quote:

> 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
My System SpecsSystem Spec
Old 01-15-2008   #7 (permalink)
Karl Prosser[MVP]


 
 

Re: when run powershell script as windows service ,powershell fail

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:
Quote:

> powershell fail on winodws 2008 wrote:
Quote:

>> 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
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
help converting msdn windows update vbs script to powershell PowerShell
Powershell V/s VB script windows installer COM object PowerShell
What is the MIME type of Windows Powershell script files (.ps1 fil PowerShell
Powershell or Windows Script PowerShell
Powershell Script as Windows Service PowerShell


Vista Forums 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 Ltd

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