This Question is Possibly Answered

1 "correct" answer available (20 pts) 1 "helpful" answer available (10 pts)
13 Replies Last post: Mar 3, 2008 9:47 AM by Zman  
Rookie 3 posts since
Feb 13, 2008
Currently Being Moderated

Feb 14, 2008 12:57 PM

Make it so a "successful" script run shows as unsuccessfull if any portion of the script gives errors?

I have a script that runs and installs a bunch of items - say a good 20 or so. The problem is even if it misses one thing (due to network problems or a server being down or whatever) then it continues on its way. Is there any way to make the script say unsuccessful when something doesn't install as it should?

Zman Master 1,841 posts since
Dec 14, 2007

 

You could use a batch file and conditionally exit on an error (EXIT /B 277). Jared wrote a great tech doc on this Understanding Batch File Distribution Packages

 

 

You could also use a language such as vbscript (YAK) or Autoitscript to exit conditionally. If you are using straight LANDesk scripts  REMEXEC0= it does not allow for conditional branching.

 

 

The question you have to address is what is failure? If you are running an EXE or internal or external command it should return an errorlevel or return code. Just test for a failing return code and exit.  If you post your script we may be able to help you further...

 

 

Zman Master 1,841 posts since
Dec 14, 2007

 

I think LANDesk purposely made the scripting very lightweight. The way I look at it:

 

 

 

 

  1. LANDesk Scripting

  2. Batch Files

  3. Package Builder

  4. Autoitscript

  5. Vbscript (Almost never)

  6. Full Blown Packagers (Wise/Admin Studio)

 

This is the order in which I approach a scripting job. All in all LANdesk offers a lot of flexibility and options. However, with flexibility and options comes more decisions.  Options 1 and 3 are just there and LANDesk is really not enhancing them. That is why in our shop it is either a simply batch file or Autoitscript. I think if you spend the time and effort to go outside the basic LANDesk scripts it will be very rewarding, but I hear ya.... I just bought this bright shiny new package and I have to learn something else outside the box.

rhyous SupportEmployee 999 posts since
Nov 19, 2007

Really the order may be different for ever user.  The order should be based on how well you know a product and how well the product works.

 

For example, I know batch files pretty well.

 

  1. Batch Files (These are not outdated, in fact, batch files are more valid and powerful today than they were in the DOS days.)

  2. Vbscript (Move to first if you know VBScript)

  3. Full Blown Packagers (Wise/Admin Studio)

  4. LANDesk Scripting (I pretty much stopped using thisin favor of a distribution package for batch files,  even though I know it well; because, if it can be done here, it can be probably be done better in a batch file.  The one feature it has that makes it best for the Inventory Scanner script, is that it can do different things depending on the platform.  So it can properly have an inventory scan run on all platforms.)

  5. Package Builder (Almost never use this anymore unless I want to make a registry key change to all user registries in xp/2000.  It doesn't even work with Vista.)

  6. Autoitscript (Never used it by I hear great things.  I am sure if some one was good at it, they could put this as #1.)

 

I hope to become a VBscript master eventually too and once I do, maybe that will move to #1.

 

Actually any number of things could be #1 for any number of administrators.  If you know perl, php, bash, you could install perl, php, cygwin, on your end workstations and go to town scripting the way you want to.  Since we don't have Distribution Packages for those, you could call them with one of the distribution packages we have without having to learn a new scripting language.

ryse Apprentice 126 posts since
Dec 16, 2007

Powershell is very powerfull as well. This would require a hot fix to be pushed over to the clients though. I started playing with it a few weeks ago.

Zman Master 1,841 posts since
Dec 14, 2007

I don't want this thread to get into a my scripting language is better than yours....However, like a lot of you older members, I've been around for sometime and have used probably every type of scripting (winbatch, batch, vbscript, perl,  Builder in the DOS days, Autoitscript, etc...). I feel compelled to give props to Autoitscript.  It is a mature, well updated and supported, great tool.  We have used it for a couple of years without any issues. It is very easy to use and extensible.  What would take a couple of hundred of lines of VBcode takes about 50 in Autoitscript.  Also I like programs that are not hooked into the OS (Powershell/VBscript) - just my opinion. Jan (JANc) has written some cool Autoitscript stuff. We wrote an entire OSD provision system before Provisioning. Take a look.

 

 

 

 

 

Autoitscript

 

 

 

 

 

Also the order I stated was just my order.......Like everyone said it will vary greatly based on numerous items.

ryse Apprentice 126 posts since
Dec 16, 2007

 

I got 100 on vbscript and auto It!!!  haha  

 

 

Zman - I've been looking into Auto It i did some basic scripts although I would like to dive into it a bit more. Do you know were I could find some good docs?

 

 

Thanks.

 

 

Zman Master 1,841 posts since
Dec 14, 2007

Ryse,

 

Any new language is daunting - verbal or computer based. The best docs are the help files. They are very well written and contain examples for each function in the help file and an open script button, that opens the example in scite so you can run it. Here are some good links:

 

 

Download AutoitScript and Scite IDE

 

 

Forum Example Scripts

 

 

Wiki

 

 

Autoit 1-2-3 Tutorial

 

 

Nice Addon for FireFox

 

 

Code Snippets

 

 

 

That should hold you for a while. There are a lot of UDFs that extend the functionality. Example, 8.8 uses SqLite for the local DB (they tool all the apm cache registry entries and placed them in a local SQlite DB). This is nice, but you can't troubleshoot policies by browsing the registry anymore. Autoitscript has builtin support for SqLite DBs. 

 

 

 

Some hints. Take it slow - small bites. Download some real world examples from the forums and open them up and investigate.  Pick a small project and go for it and have fun 

ryse Apprentice 126 posts since
Dec 16, 2007

 

Zman,

 

 

 

 

 

Thanks alot for all of the information on Auto It.  Im deff going to take your advice and dive into a  project. I believe thats the best way to learn.

 

 

Would all of Auto It's functions run in the WINPE environment? I wrote a small search and replace script and that worked fine but Im wondering if some of the more in depth scripts would work. Im thinking yes as auto it complies everything into an exe.

 

 

Thanks again!     

 

 

Zman Master 1,841 posts since
Dec 14, 2007

 

There are many Winpe scripts on the forums - ImageX GUI wrappers, etc...  I would venture to guess that there are some functions that will gag under Winpe and BartPe since they both includes only a subset of the Windows Vista

Win32 application programming interfaces (APIs), including I/O (disk

and network) and core Win32 APIs. Applications that require any of the

following Win32 APIs will not run in Windows PE: access control,

NetShow Theater Administration, OpenGL, power options, printing and

print spooler, still image, tape backup, terminal services, user

profile, Windows station and desktop, Windows multimedia, and the

Windows shell. Hooked that from technet.

 

 

 

 

 

It is a very robust scripting environment for Winpe 1/2 and BartsPe.

 

 

Some PE stuff

 

 

http://www.autoitscript.com/forum/index.php?showtopic=27077&hl=winpe

 

 

http://www.autoitscript.com/forum/index.php?showtopic=43942&hl=winpe

 

 

http://www.autoitscript.com/forum/index.php?showtopic=48007&hl=winpe

 

 

http://www.autoitscript.com/forum/index.php?showtopic=47960&hl=winpe

 

 

 

 

 

Rookie 8 posts since
Feb 21, 2008

 

ryse asked: "Would all of Auto It's functions run in the WINPE environment?"

 

 

If you complile the scripts then yes. We have a series of pretty customised OSD scripts and I added alot of functions that work in Win PE by passing inventory information to them in the OSD script. They work a treat and havent run into any problems yet!

 

 

Zman Master 1,841 posts since
Dec 14, 2007

I agree with CraigRigby we have had great success under WInpe, however, there are several posts on the autoitscript forum that indicate issues.  Again, I have not run into any issues - just test.  Also, unlike powershell - it will run under winpe 

More Like This

  • Retrieving data ...
LANDesk Community powered by Jive Software's Clearspace ® Subscribe| Legal Notices| Investor Relations| Avocent| Privacy Policy © 2009 LANDesk Software