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 - PowerShell hangs when run from 24x7

Reply
 
Old 10-25-2007   #1 (permalink)
Tom Robinson


 
 

PowerShell hangs when run from 24x7

Hi people,

I'm trying to run a PowerShell job under the 24x7 scheduler but it
hangs every time. The same job works fine under Windows Scheduler.

The actual job which is hanging is more convoluted than this, but this
simplified code illustrates the problem:

If I create a job which calls a DOS command it works fine, e.g.:

cmd /c dir

If I create a job which calls a PowerShell command the job hangs:

powershell get-date

In the Windows PowerShell log there's 7 messages for 'provider's
starting, followed by the engine state changing to available.

These messages mirror the same PowerShell command being successfully
run from the DOS prompt; EXCEPT from the DOS prompt there's then 7
corresponding messages about providers stopping plus the engine being
unavailable.

i.e. From my reading PowerShell is starting up OK and not hanging
until after startup.

There's nothing in the Application/Security/System logs.

Assuming no-one has any immediate ideas, is there a debugging switch
me or the 24x7 developers can turn on to pinpoint where the problem
is?

24x7 Multi-Platform edition 4.1 under Windows XP Pro SP2; Windows
PowerShell 1.0

TIA


My System SpecsSystem Spec
Old 10-26-2007   #2 (permalink)
Marco Shaw [MVP]


 
 

Re: PowerShell hangs when run from 24x7

Tom Robinson wrote:
Quote:

> Hi people,
>
> I'm trying to run a PowerShell job under the 24x7 scheduler but it
> hangs every time. The same job works fine under Windows Scheduler.
>
> The actual job which is hanging is more convoluted than this, but this
> simplified code illustrates the problem:
>
> If I create a job which calls a DOS command it works fine, e.g.:
>
> cmd /c dir
>
> If I create a job which calls a PowerShell command the job hangs:
>
> powershell get-date
>
> In the Windows PowerShell log there's 7 messages for 'provider's
> starting, followed by the engine state changing to available.
>
> These messages mirror the same PowerShell command being successfully
> run from the DOS prompt; EXCEPT from the DOS prompt there's then 7
> corresponding messages about providers stopping plus the engine being
> unavailable.
>
> i.e. From my reading PowerShell is starting up OK and not hanging
> until after startup.
>
> There's nothing in the Application/Security/System logs.
>
> Assuming no-one has any immediate ideas, is there a debugging switch
> me or the 24x7 developers can turn on to pinpoint where the problem
> is?
>
> 24x7 Multi-Platform edition 4.1 under Windows XP Pro SP2; Windows
> PowerShell 1.0
>
> TIA
>
There is still a popup that appears when called from an automated
scheduler. It appears 7x24 must handle that differently. Just for fun,
try running from within VBScript while hiding the popup window:
http://blog.sapien.com/current/2006/...owershell.html

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 10-26-2007   #3 (permalink)
Brandon Shell [MVP]


 
 

Re: PowerShell hangs when run from 24x7

Try launching with the -noprofile -nointeractive switches.
powershell.exe -noprofile -nointeractive -command "get-date"

"Tom Robinson" <barefootguru@xxxxxx> wrote in message
news:1193368698.541224.261020@xxxxxx
Quote:

> Hi people,
>
> I'm trying to run a PowerShell job under the 24x7 scheduler but it
> hangs every time. The same job works fine under Windows Scheduler.
>
> The actual job which is hanging is more convoluted than this, but this
> simplified code illustrates the problem:
>
> If I create a job which calls a DOS command it works fine, e.g.:
>
> cmd /c dir
>
> If I create a job which calls a PowerShell command the job hangs:
>
> powershell get-date
>
> In the Windows PowerShell log there's 7 messages for 'provider's
> starting, followed by the engine state changing to available.
>
> These messages mirror the same PowerShell command being successfully
> run from the DOS prompt; EXCEPT from the DOS prompt there's then 7
> corresponding messages about providers stopping plus the engine being
> unavailable.
>
> i.e. From my reading PowerShell is starting up OK and not hanging
> until after startup.
>
> There's nothing in the Application/Security/System logs.
>
> Assuming no-one has any immediate ideas, is there a debugging switch
> me or the 24x7 developers can turn on to pinpoint where the problem
> is?
>
> 24x7 Multi-Platform edition 4.1 under Windows XP Pro SP2; Windows
> PowerShell 1.0
>
> TIA
>
My System SpecsSystem Spec
Old 10-26-2007   #4 (permalink)
Tom Robinson


 
 

Re: PowerShell hangs when run from 24x7

In article <2FE27E71-BFC8-42ED-BB1E-CC7CDE2F9CAC@xxxxxx>,
"Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote:
Quote:

> "Tom Robinson" <barefootguru@xxxxxx> wrote in message
> news:1193368698.541224.261020@xxxxxx
Quote:

> > Hi people,
> >
> > I'm trying to run a PowerShell job under the 24x7 scheduler but it
> > hangs every time. The same job works fine under Windows Scheduler.
>
> Try launching with the -noprofile -nointeractive switches.
> powershell.exe -noprofile -nointeractive -command "get-date"
OK, tried that (it's -noninteractive) plus -nologo, but still hangs...
My System SpecsSystem Spec
Old 10-26-2007   #5 (permalink)
Brandon Shell [MVP]


 
 

Re: PowerShell hangs when run from 24x7

I'm not sure why 24x7 is messing up, but have you tried a batch wrapper just
to see if that is the problem?

@echo off
powershell.exe -noprofile -nointeractive -command "get-date"

It would seem to me, since this works with Task Scheduler, the problem is
with 24x7

"Tom Robinson" <barefootguru@xxxxxx> wrote in message
news:barefootguru-5E79D7.11172227102007@xxxxxx
Quote:

> In article <2FE27E71-BFC8-42ED-BB1E-CC7CDE2F9CAC@xxxxxx>,
> "Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote:
>
Quote:

>> "Tom Robinson" <barefootguru@xxxxxx> wrote in message
>> news:1193368698.541224.261020@xxxxxx
Quote:

>> > Hi people,
>> >
>> > I'm trying to run a PowerShell job under the 24x7 scheduler but it
>> > hangs every time. The same job works fine under Windows Scheduler.
>>
>> Try launching with the -noprofile -nointeractive switches.
>> powershell.exe -noprofile -nointeractive -command "get-date"
>
> OK, tried that (it's -noninteractive) plus -nologo, but still hangs...
My System SpecsSystem Spec
Old 10-26-2007   #6 (permalink)
Tom Robinson


 
 

Re: PowerShell hangs when run from 24x7

In article <ObyP4Z8FIHA.1208@xxxxxx>,
"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote:
Quote:

> Tom Robinson wrote:
Quote:

> > I'm trying to run a PowerShell job under the 24x7 scheduler but it
> > hangs every time. The same job works fine under Windows Scheduler.
>
> There is still a popup that appears when called from an automated
> scheduler. It appears 7x24 must handle that differently. Just for fun,
> try running from within VBScript while hiding the popup window:
> http://blog.sapien.com/current/2006/...d-powershell.h
> tml
Hey, that does work.

It's not going to help my production job though, which is a SAS program
which reads the output from PowerShell via a pipe.

Is there another way to disable the popup? Something I can give the
24x7 developers?

Thanks.
My System SpecsSystem Spec
Old 10-26-2007   #7 (permalink)
Tom Robinson


 
 

Re: PowerShell hangs when run from 24x7

In article <E7F2C446-4AEC-4FFA-80D3-75B873DBB8A5@xxxxxx>,
"Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote:
Quote:

> I'm not sure why 24x7 is messing up, but have you tried a batch wrapper just
> to see if that is the problem?
>
> @echo off
> powershell.exe -noprofile -nointeractive -command "get-date"
That hangs too, though Marco's idea of calling it from VBScript was
successful.
Quote:

> It would seem to me, since this works with Task Scheduler, the problem is
> with 24x7
Well there's certainly a problem with the interaction between 24x7 and
PowerShell. What I need to do is narrow it down enough so the 24x7
developers know how to fix it, or figure out a workaround.

24x7 support wrote:
Quote:

> I can reproduce this issue on WinXP system. Indeed powershell.exe appears to
> be hung and not doing anything. Process Explorer likely shows that it is
> waiting for some NET event. I think the best place to continue
> troubleshooting this, is to post a question in one of the MS support forums
> for NET/Powershell technologies and check how to troubleshoot this issue. If
> you can somehow debug the Powershell process and find out what resource or
> event it is waiting for, you can then figure out how to workaround that the
> entire issue.
Cheers
My System SpecsSystem Spec
Old 10-26-2007   #8 (permalink)
Brandon Shell [MVP]


 
 

Re: PowerShell hangs when run from 24x7

if using VBScript works and Powershell and CMD do not then I think the
problem is the way they handle the app. It would seem like they are looking
for something that powershell and CMD are not returning, thus they just
wait. I would be curious if you dont hide the window in vbscript if it still
works.

"Tom Robinson" <barefootguru@xxxxxx> wrote in message
news:barefootguru-381ECE.13594727102007@xxxxxx
Quote:

> In article <E7F2C446-4AEC-4FFA-80D3-75B873DBB8A5@xxxxxx>,
> "Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote:
>
Quote:

>> I'm not sure why 24x7 is messing up, but have you tried a batch wrapper
>> just
>> to see if that is the problem?
>>
>> @echo off
>> powershell.exe -noprofile -nointeractive -command "get-date"
>
> That hangs too, though Marco's idea of calling it from VBScript was
> successful.
>
Quote:

>> It would seem to me, since this works with Task Scheduler, the problem is
>> with 24x7
>
> Well there's certainly a problem with the interaction between 24x7 and
> PowerShell. What I need to do is narrow it down enough so the 24x7
> developers know how to fix it, or figure out a workaround.
>
> 24x7 support wrote:
>
Quote:

>> I can reproduce this issue on WinXP system. Indeed powershell.exe appears
>> to
>> be hung and not doing anything. Process Explorer likely shows that it is
>> waiting for some NET event. I think the best place to continue
>> troubleshooting this, is to post a question in one of the MS support
>> forums
>> for NET/Powershell technologies and check how to troubleshoot this issue.
>> If
>> you can somehow debug the Powershell process and find out what resource
>> or
>> event it is waiting for, you can then figure out how to workaround that
>> the
>> entire issue.
>
> Cheers
My System SpecsSystem Spec
Old 10-27-2007   #9 (permalink)
Tom Robinson


 
 

Re: PowerShell hangs when run from 24x7

In article <DEC0E955-EAE8-4408-B73E-08F169258910@xxxxxx>,
"Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote:
Quote:

> if using VBScript works and Powershell and CMD do not then I think the
> problem is the way they handle the app. It would seem like they are looking
> for something that powershell and CMD are not returning, thus they just
> wait. I would be curious if you dont hide the window in vbscript if it still
> works.
If I don't hide the window in the VBScript, a window flashes up, and the
job still works...

CMD works for batch files, it's only when using CMD to call PowerShell
that it also hangs.
My System SpecsSystem Spec
Old 10-27-2007   #10 (permalink)
Brandon Shell [MVP]


 
 

Re: PowerShell hangs when run from 24x7

in that case I would ask the 24x7 guys what they wait for after a command
has started

Hello Tom,
Quote:

> In article <DEC0E955-EAE8-4408-B73E-08F169258910@xxxxxx>,
> "Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote:
Quote:

>> if using VBScript works and Powershell and CMD do not then I think
>> the problem is the way they handle the app. It would seem like they
>> are looking for something that powershell and CMD are not returning,
>> thus they just wait. I would be curious if you dont hide the window
>> in vbscript if it still works.
>>
> If I don't hide the window in the VBScript, a window flashes up, and
> the job still works...
>
> CMD works for batch files, it's only when using CMD to call PowerShell
> that it also hangs.
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Automatic PowerShell Error Parsing in PowerShell Analyzer and PowerShellPlus PowerShell
PowerShell Leaders Join Forces and offer a pre-release version of PowerShell for 50% off the retail value PowerShell
PowerShell hangs while getting data from Web Service. Please Help. PowerShell
PowerShell windows hangs after VS 2005 SP 1 update PowerShell
PowerShell RTW hangs on startup 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