![]() |
![]() |
|
|||||||
| Register | Forum Rules | Getting Started! - Guide | Blog | Videos | Gallery | Members List | Social Groups | Mark Forums Read |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Guest
Posts: n/a
|
Re: Questions on PowerShell
Hi Mac
You are right. We need to start from SAS1, after succesfull completion SAS2 and so on. If SAS2 fails then we need to restart from SAS2 and continue from there to SAS3,SAS4 etc. Regarding yor last question, see if SAS2 wents down then it will be notified to the concerned person via email(this is not within our scope... we have separate people assigned who monitors the production run and notify people). So whether SAS2 down once or twice, the concerned person need to fix the problem and restart it from SAS2. Looking for your help .. ![]() -- S@gnik "Marco Shaw [MVP]" wrote: > > > One thing that we nedd to implement is > > through 1 ps1 script we need to run more than one program (say 2 SAS) and if > > one gets down then we need to restart from that step only i.e. if PGM2 went > > down then we need to skip the PGM1 and ps1 should start from PGM2. > > In dos we can achieve this by using LABEL and GOTO ... but these is not > > supported in the PowerShell. > > can you please help on this??? > > > > So you might have "SAS jobs" like this: > SAS1 > SAS2 > SAS3 > SAS4 > etc. > > You have to start at SAS1, then when finished, move to SAS2, etc.? > > Now, if you determine that at the end of SAS2, it has failed, then you > need to restart SAS2, and continue from there with SAS3, SAS4, etc? > > What about if SAS2 fails twice in a row? Keep trying or exit with an error? > > Marco > |
|
|
|
#12 |
|
Guest
Posts: n/a
|
Re: Questions on PowerShell
> DOS DOS???? > what is the range of values of > $LASTEXITCODE in Powershell... > the way we have > %ErrorLevel% in Ms-dos from 0 to 255. > Y'all know there are still people using DOS (the OS) and DOS programs? The rest of us are using Windows (the OS) and Windows console programs or Windows graphic programs or newer Windows .NET programs (console and graphic)! ![]() Anyway both Windows and PowerShell (Microsoft's admin's GUI automation tool), can also return larger numbers in their error levels too. PS> LogParser.exe "SELECT" Error: Syntax Error: <field-expr>: cannot find a valid <field-expr>: '' PS> $lastExitCode 1615 PS> LogParser.exe -h Microsoft (R) Log Parser Version 2.2.10 Copyright (C) 2004 Microsoft Corporation. All rights reserved. Usage: LogParser [-i:<input_format>] [-o:<output_format>] PS> $lastExitCode 0 Just another example of PowerShell "automating" Micosoft's Log Parser (with built-in Microsoft's ChartSpace chart maker)! |
|
|
|
#13 |
|
Guest
Posts: n/a
|
Re: Questions on PowerShell
SD wrote:
> Hi Mac > You are right. We need to start from SAS1, after succesfull completion SAS2 > and so on. > If SAS2 fails then we need to restart from SAS2 and continue from there to > SAS3,SAS4 etc. > > Regarding yor last question, see if SAS2 wents down then it will be notified > to the concerned person via email(this is not within our scope... we have > separate people assigned who monitors the production run and notify people). > So whether SAS2 down once or twice, the concerned person need to fix the > problem and restart it from SAS2. > Looking for your help .. ![]() So how about this: *If an argument isn't passed to the script, start from SAS1 *If an argument is passed to the script (like either "SAS2" or just "2"), then the script starts from that step. You can email me directly (remove _NO_SPAM_). I sometimes am forgetful. Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
< Home - Windows Help - MS Office Help - Hardware Support >
| New To Site? | Need Help? |