Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PowerShell hangs when run from 24x7

27 views
Skip to first unread message

Tom Robinson

unread,
Oct 25, 2007, 11:18:18 PM10/25/07
to
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

Marco Shaw [MVP]

unread,
Oct 26, 2007, 7:50:55 AM10/26/07
to

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/12/25/more-fun-with-scheduled-powershell.html

Marco

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

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

Blog:
http://marcoshaw.blogspot.com

Brandon Shell [MVP]

unread,
Oct 26, 2007, 8:32:22 AM10/26/07
to
Try launching with the -noprofile -nointeractive switches.
powershell.exe -noprofile -nointeractive -command "get-date"

"Tom Robinson" <barefo...@gmail.com> wrote in message
news:1193368698.5...@v23g2000prn.googlegroups.com...

Tom Robinson

unread,
Oct 26, 2007, 6:17:22 PM10/26/07
to
In article <2FE27E71-BFC8-42ED...@microsoft.com>,

"Brandon Shell [MVP]" <a_bs...@mk.hotmail.com> wrote:

> "Tom Robinson" <barefo...@gmail.com> wrote in message
> news:1193368698.5...@v23g2000prn.googlegroups.com...
> > 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...

Brandon Shell [MVP]

unread,
Oct 26, 2007, 6:47:21 PM10/26/07
to
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" <barefo...@gmail.com> wrote in message

news:barefootguru-5E79...@msnews.microsoft.com...

Tom Robinson

unread,
Oct 26, 2007, 7:57:59 PM10/26/07
to
In article <ObyP4Z8F...@TK2MSFTNGP05.phx.gbl>,
"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote:

> Tom Robinson wrote:
> > 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/12/25/more-fun-with-scheduled-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.

Tom Robinson

unread,
Oct 26, 2007, 8:59:47 PM10/26/07
to
In article <E7F2C446-4AEC-4FFA...@microsoft.com>,

"Brandon Shell [MVP]" <a_bs...@mk.hotmail.com> wrote:

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

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

> 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

Brandon Shell [MVP]

unread,
Oct 26, 2007, 9:17:52 PM10/26/07
to
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" <barefo...@gmail.com> wrote in message

news:barefootguru-381E...@msnews.microsoft.com...

Tom Robinson

unread,
Oct 27, 2007, 12:54:27 AM10/27/07
to
In article <DEC0E955-EAE8-4408...@microsoft.com>,

"Brandon Shell [MVP]" <a_bs...@mk.hotmail.com> wrote:

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

Brandon Shell [MVP]

unread,
Oct 27, 2007, 7:25:49 AM10/27/07
to
in that case I would ask the 24x7 guys what they wait for after a command
has started

Hello Tom,

Tom Robinson

unread,
Oct 28, 2007, 10:08:31 PM10/28/07
to
In article <68d19cd10808c...@news.microsoft.com>,

Brandon Shell [MVP] <tshel...@gmail.com> wrote:

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

Thanks for your help, I'll take this back to the 24x7 guys.

Cheers

0 new messages