Re: Need WMI script



If you run the script with the wscript host, Wscript.Echo commands result in
a message box with an OK button. However, if you use the cscript host,
Wscript.Echo echos to the console. If the VBScript program is called
Example.vbs, you can use a command similar to below at a command prompt:

cscript Example.vbs

I often use the //nologo optional parameter to suppress the WSH logo
information, especially if I want to redirect the output to a text file. For
example:

cscript //nologo Example.vbs > output.txt

The above assumes you are in the directory where the file Example.vbs is
saved. Otherwise, you have to specify the full path and file name in the
command.

I see that on most systems the default host is wscript, so if you just run
the vbs file, wscript.exe is used and the Wscript.Echo statements result in
message boxes. This may be what you experience. For example, that most
likely happens if you enter:

example.vbs
or
example

The default host can be changed to cscript. My reference gives the following
command to set the default to cscript:

cscript //H:cscript //S

The //S option saves this setting for the user. The command:

cscript //I //nologo //H:cscript //S

saves 3 options for the particular user (on this computer), the //I option
specifies interactive mode (which I think is the default anywayt), //nologo
suppresses the WSH logo information, //H:cscript assigns cscript.exe as the
default host, and //S saves the settings for the user.

I don't alter the settings, since I've gotten into the habit of always using
cscript. When I tried a VBScript program just now with no host specified, I
saw how annoying the default wscript.exe can be.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--

"Sriman" <Sriman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:379C3080-99DB-43AC-B8F7-955A878BE47C@xxxxxxxxxxxxxxxx
Yes, If i use the Wscript.Echo its giving alert with ok button. I am
looking
for the code which will displays the output to the console.

"Richard Mueller [MVP]" wrote:


"Sriman" <Sriman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8B3A9920-4D17-41FE-8069-8F3224F6F169@xxxxxxxxxxxxxxxx
Hi Mueller,

Thanks for your reply.
I have question. Is there any method which will print the out put(other
than
into file) other than Wscript.Echo ..like write, print etc., My
requirement
is to display the status of the group and down to the user details to
the
admin and write those details to file. using filesystem we can write
into
file.But how to display the details?

Regards,
Sri

I don't know of any way to print from a VBScript program. I generally use
Wscript.Echo commands to echo information to the console. I can redirect
the
output to a text file, using the ">" redirection character. You can also
use
the FileSystemObject to write information to a text file.

You can also use the MsgBox function to display information to users.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--





.