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/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
"Tom Robinson" <barefo...@gmail.com> wrote in message
news:1193368698.5...@v23g2000prn.googlegroups.com...
> "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...
@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 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.
> 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
"Tom Robinson" <barefo...@gmail.com> wrote in message
news:barefootguru-381E...@msnews.microsoft.com...
> 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.
Hello Tom,
> 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