Server Administration

An unchanged VBS inventory script uses COM objects and WScript.Echo for reporting. It must run unattended as a scheduled task and capture its messages in a text log; which approach meets these requirements?

Show the answer

Correct answerB. Use cscript.exe and redirect standard output

AWhy not this: The graphical host normally displays WScript.Echo messages in dialog boxes rather than sending them to standard output.

BWhy this is right: The console host supports VBScript and sends WScript.Echo messages to output that can be redirected to a file.

CWhy not this: cmd.exe does not interpret VBScript syntax as batch commands.

DWhy not this: PowerShell does not interpret an unchanged VBScript file as PowerShell source.

cscript.exe runs VBScript with a console host, so WScript.Echo messages can be redirected to a log without dialog boxes. Under wscript.exe, WScript.Echo normally displays message boxes, which are unsuitable for unattended reporting.