What is NScript and how does it work?
search cancel

What is NScript and how does it work?

book

Article ID: 179744

calendar_today

Updated On:

Products

IT Management Suite Client Management Suite

Issue/Introduction

Question
What is NScript.exe and how does it work?

Resolution

Answer
NScript is a .NET executable that comes with a Notification Server. It is located under '%InstalPath%\Notification Server\Bin' and allows to run C# files as a script, thus avoiding the need to compile the files into .NET assemblies.

The benefits of having scripting access to the Notification Server system are

  • The possibility of running a script for development to fix a known issue.
  • The possibility to automate console or Notification Server tasks that are not included in the ASDK (such as PMS and so on).

NScript usage:

C:\Program Files\Altiris\Notification Server\bin>NScript.exe
NScript - A .NET execution engine
=================================

 

Usage: NScript.exe [Flags] ScriptFileName ScriptArg1 ScriptArg2 ScriptArgN

Flags:
  -?  This help text
  -v  Verbose mode - show parameter(s), compilation status, etc

ScriptFileName:
  The name of the script file that you wish to execute. The language can be
  either C# or VisualBasic.NET. The file must contain a Main( string[] args )
  method, which is the entry point of the script file.

ScriptArg1 ScriptArg2 ScriptArgN:
  The parameters after ScriptFileName are passed to the Main( string[] args )
  method for the use of the script to do whatever it needs to do.

Press the enter key to exit.

Example:

  1. Copy the NScript to the ...\Program Files\Altiris\Notification Server\bin directory
  2. Execute the following command from a DOS windows (using the working directory from above):   
    nscript.exe MyNScript.cs