Jump to content

Pass command line variables to a vbscript


Recommended Posts

I'm trying to run a vbscript from autoit, but cannot get the script to run if I try to pass any parameters to it. It runs if I call it with no parameters. It's a vbscript to add a machine name to a SCCM collection. I want to let other techs here (who don't have access to the SCCM console) add machines to the "Unknown Computer" collection so they can un OS task sequeces on machines already known to SCCM.

Here's an example: RunWait('wscript.exe "C:\Temp\CollAdd.vbs sccmserver machinename collectionID"') I take the three parameters off the end of the string and it runs CollAdd.vbs though it complains about missing parameters as it should. I get a " no script engine found for .vbs sccmserver machinename collectionID" error with the parameters.

I've tried a RunCMD function we use here (w/ Comspec), shellexecute, runwait, etc. Runs fine if no args are included. I know I should convert the whole vbscript to autoit, but I'm trying to give the other techs a start on building with SCCM so I can create the rest of the images and task sequences for our other builds. Anyone able to do this?

Thanks,

Ray

Sorry, forgot to add that it does run fine from Start, Run on Win 7 or XP.

Edited by RayRay
Link to comment
Share on other sites

Odd that it truncated the first parameter for the error message, returning only the ".vbs" part of it!

I'd be tempted to write the output to a text file and examine it carefully there to determine why it is breaking at that point. Alternatively, rename that text file to a *.cmd file and try to execute that from a command shell to see if there are any error messages returned from wscript.exe that may give a clue as to the cause of the problem - some of those messages are returned using printf instead of standardIO and so the error handler doesn't see them!

Just a thought!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...