© 2010 ActiveXperts Software B.V. - contact@activexperts.com
ActiveXperts Scripting Toolkit enables Software Developers to run a VBScript program or a command-line tool without invoking the Windows Scripting Host or console window. With ActiveXperts Scripting Toolkit, VBScript programs and command-line tools can be invoked from any (web) application, (web) service or script.
Some benefits of using ActiveXperts Scripting Toolkit instead of using the Windows Scripting Host to run VBScript programs:
Some benefits of using ActiveXperts Scripting Toolkit instead of the command prompt to run command tools:
The core of ActiveXperts Scripting Toolkit is an ActiveX/COM component that comes in a 32-bit and a 64-bit version:
ActiveXperts Scripting Toolkit can be distributed easily to any Windows computer. Once you have purchased the license, you copy the AxScript.dll (or AxScriptx64.dll) to the workstations or servers and register the DLL on those machines.
The ActiveXperts Scripting Toolkit component can be used by any of these development/scripting languages:
ActiveXperts Scripting Toolkit can be used on any of the following Operating Systems:
The ActiveXperts Scripting Toolkit package consists of 3 components; any combination of components can be installed:
Simply run the AxScript.exe Setup program. The InstallShield wizard will guide you through the rest of the setup.
If you choose the ActiveXperts Scripting Toolkit ActiveX/COM component, the Setup program can
perform the registration of the COM component for you. But it will also
give you the opportunity to register the object yourself.
Any subsequent installation of ActiveXperts Scripting Toolkit can be performed either manually or by using the Setup program.
Any subsequent installations can be performed using the setup program.
But since the installation of the core components is very simple, you
may want to do it manually, or integrate it into your companies
software distribution program.
If you choose to install the ActiveX/COM component manually on other machines, simply perform the following actions:
The following code snippets (VBScript) illustrate how to use ActiveXperts Scripting Toolkit.
Imports AxScript ' Include ActiveXperts Scripting Toolkit Dim objVBScript As VBScript = New VBScript() ' Declare and create object Dim objVBScriptResult As VBScriptResult ' Declare object objVBScript.Clear() ' Clear all parameters objVBScript.ScriptFile = "C:\Scripts\GetDirectorySize.vbs" ' Set script file objVBScript.Function = "GetDirectorySizeString" ' Set Function objVBScript.Timeout = 5000 ' Set Script Timeout ' Set First Parameter objVBScript.Parameter1 = Chr(34) & "C:\Temp\" & Chr(34) ' Set first parameter ' Run the script objVBScriptResult = objVBScript.Run() ' Run the script Console.WriteLine("RunResultCode : {0}", objVBScriptResult.RunResultCode) Console.WriteLine("RunResultDescription : {0}", objVBScriptResult.RunResultDescription) If (objVBScriptResult.RunResultCode = 0) Then Console.WriteLine("FunctionReturnString : {0}", objVBScriptResult.FunctionReturnString) Console.WriteLine("FunctionReturnNumber : {0}", objVBScriptResult.FunctionReturnNumber) Else Console.WriteLine("ErrorSource : {0}", objVBScriptResult.ErrorSource) Console.WriteLine("ErrorDescription : {0}", objVBScriptResult.ErrorDescription) Console.WriteLine("ErrorLineNum : {0}", objVBScriptResult.ErrorLineNum) Console.WriteLine("ErrorCharPos : {0}", objVBScriptResult.ErrorCharPos) Console.WriteLine("ErrorCode : {0,8:X}", objVBScriptResult.ErrorCode) End If
Imports AxScript ' Include ActiveXperts Scripting Toolkit Dim objRemoteCmd As RemoteCommand = New RemoteCommand() ' Declare and create object objRemoteCmd.Clear() ' Clear all parameters objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote host objRemoteCmd.UserName = "Admin01" ' Set user account objRemoteCmd.Password = "topsecret" ' Set user password objRemoteCmd.CommandTimeout = 5000 ' Set command timeout objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError ) Console.WriteLine("StdOut received: {0}", objRemoteCmd.StdOut) Console.WriteLine("StdErr received: {0}", objRemoteCmd.StdErr)
First, make sure the ActiveXperts Scripting Toolkit component (AxScript.dll or AxScriptx64.dll) is registered on the machine. In case you didn't use the installation program, be sure you used the REGSVR32.EXE program to register to component.
Then, add a reference to the ActiveXperts Scripting Toolkit component using the Visual Basic .NET Solution Explorer:
On top of the code, make this declaration:
Imports AxScript
and declare and create an object like this:
Dim objVBScript As VBScript = New VBScript() ' Declaration and Creation of VBScript object Dim objRemoteCmd As RemoteCommand = New RemoteCommand() ' Declaration and Creation of RemoteCommand object
After the declaration and creation of the object, you can use the object in your Visual Basic .NET code.
Visual Basic .NET samples are part of the product installation.
They can also be found online: ftp.activexperts-labs.com/samples/vbscript-powershell-component.
First, make sure the ActiveXperts Scripting Toolkit component (AxScript.dll or AxScriptx64) is registered on the machine. In case you didn't use the installation program, be sure you used the REGSVR32.EXE program to register to component.
Then, add a reference to the object using the Visual C# Solution Explorer:
On top of your code, make this declaration:
using AxScript;
and declare and create an object like this:
VBScript objVBScript = = new VBScript(); // Declaration and Creation RemoteCommand objRemoteCmd = new RemoteCommand(); // Declaration and Creation
After the declaration and creation of the object, you can use the object in your Visual C# .NET code.
Visual C# .NET samples are part of the product installation.
They can also be found online: ftp.activexperts-labs.com/samples/vbscript-powershell-component.
ActiveXperts Scripting Toolkit can be used in Visual Basic 5.x or higher. In Visual Basic, go to the 'Project/References...' menu item and check the box next to ActiveXperts Scripting Toolkit Type Library. Now, you can declare and create ActiveXperts Scripting Toolkit objects.
Create a new ActiveXperts Scripting Toolkit object using the 'CreateObject' function:
Dim objVBScript As AxScript.VBScript ' Declaration Set objVBScript = CreateObject( "ActiveXperts.VBScript") ' Creation Dim objRemoteCmd As AxScript.RemoteCommand ' Declaration Set objRemoteCmd = CreateObject( "ActiveXperts.RemoteCommand") ' Creation
After the declaration and creation of the object, you can use the object in your Visual Basic code.
Visual Basic samples are part of the product installation.
They can also be found online: ftp.activexperts-labs.com/samples/vbscript-powershell-component.
ActiveXperts Scripting Toolkit can be used in Visual C++ projects. Include the *.h and *.c file provided by ActiveXperts to bind your code to the ActiveXperts Scripting Toolkit component. These files are located in the Include directory of the Visual C++ samples directory. These are the files:
Create the various ActiveXperts Scripting Toolkit object instances like this:
IVBScript *pScript; // Declaration CoCreateInstance(CLSID_VBScript, NULL, CLSCTX_INPROC_SERVER, IID_IVBScript, (void**) &pScript ); // Creation IRemoteCommand *pRemoteCommand; // Declaration CoCreateInstance(CLSID_RemoteCommand, NULL, CLSCTX_INPROC_SERVER, IRemoteCommand, (void**) &pRemoteCommand ); // Creation
After the declaration and creation of the object, you can use the object in your Visual C++ code.
Visual C++ samples are part of the product installation.
They can also be found online: ftp.activexperts-labs.com/samples/vbscript-powershell-component.
<html> <body> Version: <script language=vbscript runat=server> Set objVBScript = CreateObject( "ActiveXperts.VBScript" ) Set objRemoteCmd = CreateObject( "ActiveXperts.RemoteCommand" ) Response.Write objVBScript.Version </script> </body> </html>
ASP samples are part of the product installation.
They can also be found online: ftp.activexperts-labs.com/samples/vbscript-powershell-component.
| Property | Type | In/Out | Mand/Opt | Description |
| Version | String | Out | n/a | Version number of ActiveXperts Scripting Toolkit |
| Build | String | Out | n/a | Build number of ActiveXperts Scripting Toolkit |
| Module | String | Out | n/a | Module DLL name of ActiveXperts Scripting Toolkit |
| ExpirationDate | String | Out | n/a | Expiration date of ActiveXperts Scripting Toolkit |
| ScriptFile | String | In/Out | M | Full-path script file location |
| Function | String | In/Out | M | Function to call |
| Parameter1 | String | In/Out | O | 1st Parameter (if available) |
| Parameter2 | String | In/Out | O | 2nd Parameter (if available) |
| Parameter3 | String | In/Out | O | 3rd Parameter (if available) |
| Parameter4 | String | In/Out | O | 4th Parameter (if available) |
| Parameter5 | String | In/Out | O | 5th Parameter (if available) |
| Parameter6 | String | In/Out | O | 6th Parameter (if available) |
| Parameter7 | String | In/Out | O | 7th Parameter (if available) |
| Parameter8 | String | In/Out | O | 8th Parameter (if available) |
| Timeout | Number | In/Out | O | Script timeout (in milliseconds) |
| LogFile | String | In/Out | O | Log file used for troubleshooting purposes |
| Function | Description |
| Clear | Reset all properties to the default values |
| Run | Run the selected function in the selected script |
| Activate | Activate the product |
Version information of ActiveXperts Scripting Toolkit. This property is read-only; you cannot assign a value to it.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance
Console.WriteLine( "Scripting Toolkit Version: " & objVBScript.Version )
Build information of ActiveXperts Scripting Toolkit. This property is read-only; you cannot assign a value to it.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance
Console.WriteLine( "Scripting Toolkit Version: " & objVBScript.Version )
Console.WriteLine( "Scripting Toolkit Build: " & objVBScript.Build )
DLL module name of ActiveXpert Scripting Toolkit. Can be either AxScript.dll or AxScript64.dll
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance
Console.WriteLine( "Scripting Toolkit Version: " & objVBScript.Version )
Console.WriteLine( "Scripting Toolkit Module: " & objVBScript.Module )
Expiration date of ActiveXperts Scripting Toolkit. This property is read-only; you cannot assign a value to it.
Once you have registered the product, the property holds the empty string ("") value.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance
Console.WriteLine( "Scripting Toolkit ExpirationDate: " & objVBScript.ExpirationDate )
The VBScript file that holds the function that you want to run.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance ... objVBScript.ScriptFile = "c:\my scripts\myscript.vbs" ' myscript.vbs is the script that holds function 'Func1' objVBScript.Function = "Func1" ' Call 'Func1' when Run is invoked Set objVBScriptResult = objVBScript.Run() ' Run the function Console.WriteLine("RunResultCode : {0}", objVBScriptResult.RunResultCode) Console.WriteLine("RunResultDescription : {0}", objVBScriptResult.RunResultDescription)
The function that is called when run is invoked.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance ... objVBScript.ScriptFile = "c:\my scripts\myscript.vbs" ' myscript.vbs is the script that holds function 'Func1' objVBScript.Function = "Func1" ' Call 'Func1' when Run is invoked Set objVBScriptResult = objVBScript.Run() ' Run the function Console.WriteLine("RunResultCode : {0}", objVBScriptResult.RunResultCode) Console.WriteLine("RunResultDescription : {0}", objVBScriptResult.RunResultDescription)
The parameters to be passed to the function. NOTE: String parameters must be enclosed by double quotes (like: "My First Parameter")
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance ... objVBScript.ScriptFile = "c:\my scripts\myscript.vbs" ' myscript.vbs is the script that holds function 'Func1' objVBScript.Function = "Func1" ' Call 'Func1' when Run is invoked Set objVBScriptResult = objVBScript.Run() ' Run the function Console.WriteLine("RunResultCode : {0}", objVBScriptResult.RunResultCode) Console.WriteLine("RunResultDescription : {0}", objVBScriptResult.RunResultDescription)
Number of milliseconds before the run method will time-out. Use this 'Timeout' propery to ensure that Run returns control in case that the called function does not return, for instance because of an endless loop.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance ... objVBScript.ScriptFile = "c:\my scripts\myscript.vbs" objVBScript.Timeout = 8000 ' Timeout after 8000 milliseconds objVBScript.Function = "Func1" Set objVBScriptResult = objVBScript.Run() ' Run the function Console.WriteLine("RunResultCode : {0}", objVBScriptResult.RunResultCode) Console.WriteLine("RunResultDescription : {0}", objVBScriptResult.RunResultDescription)
By default, LogFile holds the empty string and nothing is logged. If you assign a valid file name to it, all operations will be written to this log file. Output is always appended.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance ... objVBScript.LogFile = "c:\logfile.txt" ' Log all operations objVBScript.ScriptFile = "c:\my scripts\myscript.vbs" objVBScript.Function = "Func1" Set objVBScriptResult = objVBScript.Run() ' Run the function Console.WriteLine("RunResultCode : {0}", objVBScriptResult.RunResultCode) Console.WriteLine("RunResultDescription : {0}", objVBScriptResult.RunResultDescription)
Reset all properties to their initial values.
None.
Always 0.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance objVBScript.Clear() objVBScript.ScriptFile = "c:\my scripts\myscript.vbs" objVBScript.Function = "Func1" Set objVBScriptResult = objVBScript.Run() ... objVBScript.Clear() ' Clear all properties ...
Run the selected function in the selected script.
None.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance ... objVBScript.ScriptFile = "c:\my scripts\myscript.vbs" ' myscript.vbs is the script that holds function 'Func1' objVBScript.Function = "Func1" ' Call 'Func1' when Run is invoked Set objVBScriptResult = objVBScript.Run() ' Run the function Console.WriteLine("RunResultCode : {0}", objVBScriptResult.RunResultCode) Console.WriteLine("RunResultDescription : {0}", objVBScriptResult.RunResultDescription)
This function activates the ActiveXperts Scripting Toolkit product. A valid registration key is required.
Always 0.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance objVBScript.Activate "xxxxx-xxxxx-xxxxx", True ' Use a valid registration code ' Pass True to make the activation persistent, so you need ' to call Activate only once. If you pass False, you need ' to call Activate each time the product is started.
| Property | Type | In/Out | Mand/Opt | Description |
| RunResultCode | Number | Out | n/a | Result (numeric) of the last 'Run' call |
| RunResultDescription | String | Out | n/a | Result (friendly string) of the last 'Run' call |
| FunctionReturnNumber | Number | Out | n/a | If function returns a numeric value, this property holds the actual return value after completion |
| FunctionReturnString | String | Out | n/a | If function returns a string value, this property holds the actual return value after completion |
| FunctionReturnInfo | Variant | Out | n/a | If function returns a Variant, this property holds the actual return value after completion |
| ErrorSource | String | Out | n/a | Source file that contains the error |
| ErrorDescription | String | Out | n/a | Description of the error |
| ErrorLineNum | Number | Out | n/a | Line number in source code where error occured |
| ErrorCharPos | Number | Out | n/a | Character position in source code where error occured |
| ErrorCode | Number | Out | n/a | Microsoft VBScript Engine error code |
Result of the last Run call.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance
Console.WriteLine( "Scripting Toolkit Version: " & objVBScript.Version )
Return value of the last Run call. Only one the properties will be assigned, depending on the datatype. If the function returns a numeric value, then 'FunctionReturnNumber' will hold the return value; if the function returns a string value, then 'FunctionReturnString' will hold the return value; if the function returns a Variant value, then 'FunctionReturnInfo' will hold the return value.
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance ... objVBScript.ScriptFile = "c:\my scripts\myscript.vbs" ' myscript.vbs is the script that holds function 'Func1' objVBScript.Function = "Func1" ' Call 'Func1' when Run is invoked Set objVBScriptResult = objVBScript.Run() ' Run the function Console.WriteLine("RunResultCode : {0}", objVBScriptResult.RunResultCode) Console.WriteLine("RunResultDescription : {0}", objVBScriptResult.RunResultDescription) If (objVBScriptResult.RunResultCode = 0) Then Console.WriteLine("FunctionReturnString : {0}", objVBScriptResult.FunctionReturnString) Console.WriteLine("FunctionReturnNumber : {0}", objVBScriptResult.FunctionReturnNumber) Else Console.WriteLine("ErrorSource : {0}", objVBScriptResult.ErrorSource) Console.WriteLine("ErrorDescription : {0}", objVBScriptResult.ErrorDescription) Console.WriteLine("ErrorLineNum : {0}", objVBScriptResult.ErrorLineNum) Console.WriteLine("ErrorCharPos : {0}", objVBScriptResult.ErrorCharPos) Console.WriteLine("ErrorCode : {0,8:X}", objVBScriptResult.ErrorCode) End If
These properties are set when Run failed (i.e. when RunResultCode is not equal to 0):
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance ... objVBScript.ScriptFile = "c:\my scripts\myscript.vbs" ' myscript.vbs is the script that holds function 'Func1' objVBScript.Function = "Func1" ' Call 'Func1' when Run is invoked Set objVBScriptResult = objVBScript.Run() ' Run the function Console.WriteLine("RunResultCode : {0}", objVBScriptResult.RunResultCode) Console.WriteLine("RunResultDescription : {0}", objVBScriptResult.RunResultDescription) If (objVBScriptResult.RunResultCode = 0) Then Console.WriteLine("FunctionReturnString : {0}", objVBScriptResult.FunctionReturnString) Console.WriteLine("FunctionReturnNumber : {0}", objVBScriptResult.FunctionReturnNumber) Else Console.WriteLine("ErrorSource : {0}", objVBScriptResult.ErrorSource) Console.WriteLine("ErrorDescription : {0}", objVBScriptResult.ErrorDescription) Console.WriteLine("ErrorLineNum : {0}", objVBScriptResult.ErrorLine) Console.WriteLine("ErrorCharPos : {0}", objVBScriptResult.ErrorChar) Console.WriteLine("ErrorCode : {0,8:X}", objVBScriptResult.ErrorCode) End If
| Property | Type | In/Out | Mand/Opt | Description |
| Version | String | Out | n/a | Version number of ActiveXperts Scripting Toolkit |
| Build | String | Out | n/a | Build number of ActiveXperts Scripting Toolkit |
| Module | String | Out | n/a | Module DLL name of ActiveXperts Scripting Toolkit |
| ExpirationDate | String | Out | n/a | Expiration date of ActiveXperts Scripting Toolkit |
| LastError | Number | Out | n/a | Result of the last called function |
| Host | String | In/Out | M | Specifies the Windows computer on which to run the command |
| UserName | String | In/Out | O | Specifies the user name to use on the remote host. If omitted, the logged on user name is used. |
| Password | String | In/Out | O | The password associated with the UserName |
| CommandTimeout | Number | In/Out | O | Specifies the number of milliseconds before the command times out |
| Command | String | In/Out | M | Specifies the command to run on the remote computer |
| StdOut | String | Out | n/a | The resulting standard output |
| StdErr | String | Out | n/a | The resulting standard error |
| LogFile | String | In/Out | O | Log file used for troubleshooting purposes |
| Function | Description |
| Clear | Reset all properties to the default values |
| Sleep | Run the selected function in the selected script |
| Run | Run the selected function in the selected script |
| GetErrorDescription | Get error description |
| Activate | Activate the product |
Version information of ActiveXperts Scripting Toolkit. This property is read-only; you cannot assign a value to it.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() ' Create a new RemoteCommand instance
Console.WriteLine( "Scripting Toolkit Version: " & objRemoteCmd.Version )
Build information of ActiveXperts Scripting Toolkit. This property is read-only; you cannot assign a value to it.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() ' Create a new RemoteCommand instance
Console.WriteLine( "Scripting Toolkit Version: " & objRemoteCmd.Version )
Console.WriteLine( "Scripting Toolkit Build: " & objRemoteCmd.Build )
DLL module name of ActiveXpert Scripting Toolkit. Can be either AxScript.dll or AxScript64.dll
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() ' Create a new RemoteCommand instance
Console.WriteLine( "Scripting Toolkit Version: " & objRemoteCmd.Version )
Console.WriteLine( "Scripting Toolkit Build: " & objRemoteCmd.Build )
Expiration date of ActiveXperts Scripting Toolkit. This property is read-only; you cannot assign a value to it.
Once you have registered the product, the property holds the empty string ("") value.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() ' Create a new RemoteCommand instance
Console.WriteLine( "Scripting Toolkit ExpirationDate: " & objRemoteCmd.ExpirationDate )
The result of a previous called Run function. Use it to check the result of your last function call. A zero indicates: success. Any non-zero value means an error. The GetErrorDescription function provides the error description of an error code. For a complete list of error codes, check out the following page: www.activexperts.com/support/errorcodes.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote Windows computer objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set remote command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError ) ' Show the result
Specifies the computer on which to run the command.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote Windows computer objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set remote command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError ) Console.WriteLine("StdOut received: {0}", objRemoteCmd.StdOut) Console.WriteLine("StdErr received: {0}", objRemoteCmd.StdErr)
Specifies the user name to use on the remote host. If omitted, the logged on credentials are used, if not omitted, a Password is required.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote Windows computer objRemoteCmd.UserName = "ACTIVEXPERTS\JohnD" ' Set Windows user account (optional) objRemoteCmd.Password = "topsecret" ' Set Windows user password (optional) objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set remote command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError ) Console.WriteLine("StdOut received: {0}", objRemoteCmd.StdOut) Console.WriteLine("StdErr received: {0}", objRemoteCmd.StdErr)
Specifies the number of milliseconds until the command times out.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote Windows computer objRemoteCmd.UserName = "ACTIVEXPERTS\JohnD" ' Set Windows user account (optional) objRemoteCmd.Password = "topsecret" ' Set Windows user password (optional) objRemoteCmd.CommandTimeout = 8000 ' Set timeout to 8000 milliseconds objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set remote command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError )
Specifies the command to run on the remote computer.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote Windows computer objRemoteCmd.UserName = "ACTIVEXPERTS\JohnD" ' Set Windows user account (optional) objRemoteCmd.Password = "topsecret" ' Set Windows user password (optional) objRemoteCmd.CommandTimeout = 8000 ' Set timeout to 8000 milliseconds objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set remote command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError )
After the command is executed, the standard output of the remote command is stored in the 'StdOut' property.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote Windows computer objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set remote command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError ) Console.WriteLine("StdOut received: {0}", objRemoteCmd.StdOut) ' Show standard output Console.WriteLine("StdErr received: {0}", objRemoteCmd.StdErr)
After the command is executed, the standard error of the remote command is stored in the 'StdErr' property.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote Windows computer objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set remote command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError ) Console.WriteLine("StdOut received: {0}", objRemoteCmd.StdOut) Console.WriteLine("StdErr received: {0}", objRemoteCmd.StdErr) ' Show standard error
By default, LogFile holds the empty string and nothing is logged. If you assign a valid file name to it, all operations will be written to this log file. Output is always appended.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.LogFile = "c:\file.log" ' Set Logfile objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote Windows computer objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set remote command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError )
Reset all properties to their initial values.
None.
Always 0.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.Clear() ' Clear all properties of the object objRemoteCmd.Host = "appserver02.activexperts.intra" objRemoteCmd.Command = "dir /S C:\InetPub\" objRemoteCmd.Run() ' Run the command ... objRemoteCmd.Clear() ' Clear all properties of the object ... objRemoteCmd.Run() ' Run the command
Run the specified command.
Always 0. Check the LastError property to see if the function was completed successfully.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.LogFile = "c:\file.log" ' Set Logfile objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote Windows computer objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set remote command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError ) ' Display result of the Run function
Delay your application or program for a few milliseconds
Always 0.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.Host = "appserver02.activexperts.intra" objRemoteCmd.Command = "dir /S C:\InetPub\" objRemoteCmd.Run() ' Run the command objRemoteCmd.Sleep( 5000 ) ' Pause for 5000 milliseconds objRemoteCmd.Host = "appserver02.activexperts.intra" objRemoteCmd.Command = "dir /S C:\Windows\" objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} )", objRemoteCmd.LastError ) ' Display result of the Run function
GetErrorDescription provides the error description of a given error code.
The error description that is associated with the given error code.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() objRemoteCmd.Host = "appserver02.activexperts.intra" ' Set remote Windows computer objRemoteCmd.Command = "dir /S C:\InetPub\" ' Set remote command objRemoteCmd.Run() ' Run the command Console.WriteLine("Executed command, result: {0} ({1})", objRemoteCmd.LastError, objRemoteCmd.GetErrorDescription(objRemoteCmd.LastError) )
This function activates the ActiveXperts Scripting Toolkit product. A valid registration key is required.
Always 0.
Dim objRemoteCmd As RemoteCommand = New RemoteCommand() ' Create a new RemoteCommand instance objRemoteCmd.Activate "xxxxx-xxxxx-xxxxx", True ' Use a valid registration code ' Pass True to make the activation persistent, so you need ' to call Activate only once. If you pass False, you need ' to call Activate each time the product is started.
Samples for Visual C# .NET, Visual Basic .NET, Visual Basic, Visual C++, ASP, Borland Delphi, PHP, HTML, VBScript and other development platforms are included as part of the installation. You can also find the samples on our website at ftp.activexperts-labs.com/samples/vbscript-powershell-component.
Visit our website for a complete list of FAQ's at: http://www.activexperts.com/support
Please contact our website for support questions about this product, or send an email to our support-staff:
Website: http://www.activexperts.com/support
E-mail: support@activexperts.com
Please visit www.activexperts.com/sales to buy the product. Here, you can also find the latest prices.
You can also contact us via email: sales@activexperts.com
After you purchase the product, you will receive one or more product registration keys.
After you purchase the product, you will receive a registration code. This code must be entered on the target computer(s).
You can do this by using the component's 'Activate' function:
Dim objVBScript As VBScript = New VBScript() ' Create a new Scripting instance objVBScript.Activate XXXXX-XXXXX-XXXXX", True ' Replace XXXXX-XXXXX-XXXXX by your own registration code ' Pass True to make the activation persistent, so you need to call Activate ' only once. If you pass False, you need to call Activate each time the ' product is started.
Or you can activate by (re)installing the product using the Setup
program. The InstallShield wizard will prompt for the registration code.
Or you can activate by editing the registry:
For information about how to use the registration code with a Distribution License, please read the following document: How to distribute an ActiveXperts Toolkit
PLEASE READ THIS SOFTWARE LICENSE AGREEMENT CAREFULLY BEFORE
DOWNLOADING OR USING THE SOFTWARE. BY CLICKING ON THE
"ACCEPT" BUTTON, OPENING THE PACKAGE, DOWNLOADING THE PRODUCT,
OR USING THE EQUIPMENT THAT CONTAINS THIS PRODUCT, YOU ARE
CONSENTING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE
TO ALL OF THE TERMS OF THIS AGREEMENT, CLICK THE "DO NOT
ACCEPT" BUTTON AND THE INSTALLATION PROCESS WILL NOT CONTINUE,
RETURN THE PRODUCT TO THE PLACE OF PURCHASE FOR A FULL REFUND,
OR DO NOT DOWNLOAD THE PRODUCT.
GENERAL
In this Software License Agreement:
(i) "ActiveXperts" means ActiveXperts Software B.V.
(ii) "Customer" means the individual(s), organization or business entity
buying a license of the Software from ActiveXperts or its Distributors
or its Resellers.
(iii) "Software" means computer programs (and their storage medium)
supplied by ActiveXperts and known collectively as "ActiveXperts Scripting Toolkit"
in which ActiveXperts has property rights and any user manuals,
operating instructions, brochures and all other documentation relating
to the said computer programs (the expression "Software" to include all
or any part or any combination of Software).
1. LICENSE GRANT
ActiveXperts grants Customer the following rights provided that you
comply with all terms and conditions of this License Agreement:
(a) Installation and use. Customer may install, use, access, display and
run one copy of the Software on a single computer, such as a
workstation, terminal or other device ("Workstation Computer"). A
"License Pack" allows you to install, use, access, display and run
additional copies of the Software up to the number of "Licensed Copies"
specified above.
(b) Reservation of Rights. ActiveXperts reserves all rights not
expressly granted to you in this License Agreement.
2. UPGRADES AND SUPPLEMENTS
To use a product identified as an upgrade, you must first be licensed
for the Software as eligible for the upgrade. After upgrading, Customer
may no longer use the product that formed the basis for Customer's
upgrade eligibility.
This License Agreement applies to updates or supplements to the original
Software provided by ActiveXperts, unless we provide other terms along
with the update or supplement.
3. LIMITATION ON REVERSE ENGINEERING,DECOMPILATION, AND DISASSEMBLY
Customer may not reverse engineer, decompile, or disassemble the
Software, except and only to the extent that it is expressly permitted
by applicable law notwithstanding this limitation.
4. TERMINATION
Without prejudice to any other rights, ActiveXperts may cancel this
License Agreement if Customer does not abide by the terms and conditions
of this License Agreement, in which case you must destroy all copies of
the Software and all of its component parts.
5. NOT FOR RESALE SOFTWARE
Software identified as "Not for Resale" or "NFR," may not be resold,
transferred or used for any purpose other than demonstration, test or
evaluation.
6. LIMITED WARRANTY
ActiveXperts warrants that for a period of ninety (90) days from the
date of shipment from ActiveXperts: (i) the media on which the Software
is furnished will be free of defects in materials and workmanship under
normal use; and (ii) the Software substantially conforms to its
published specifications. Except for the foregoing, the Software is
provided AS IS. This limited warranty extends only to Customer as the
original licensee. Customer's exclusive remedy and the entire liability
of ActiveXperts and its suppliers under this limited warranty will be,
at ActiveXperts or its service center's option, repair, replacement, or
refund of the Software if reported (or, upon request, returned) to the
party supplying the Software to Customer. In no event does ActiveXperts
warrant that the Software is error free or that Customer will be able to
operate the Software without problems or interruptions.
This warranty does not apply if the software (a) has been altered,
except by ActiveXperts, (b) has not been installed, operated, repaired,
or maintained in accordance with instructions supplied by ActiveXperts,
(c) has been subjected to abnormal physical or electrical stress,
misuse, negligence, or accident, or (d) is used in ultrahazardous
activities.
7. LIMITATION OF LIABILITY AND REMEDIES.
Notwithstanding any damages that you might incur for any reason
whatsoever (including, without limitation, all damages referenced above
and all direct or general damages), the entire liability of ActiveXperts
and any of its suppliers under any provision of this License Agreement
and your exclusive remedy for all of the foregoing (except for any
remedy of repair or replacement elected by ActiveXperts with respect to
any breach of the Limited Warranty) shall be limited to the greater of
the amount actually paid by you for the Software or U.S.$5.00. The
foregoing limitations, exclusions and disclaimers (including Sections 4,
5 and 6 above) shall apply to the maximum extent permitted by applicable
law, even if any remedy fails its essential purpose.
8. ENTIRE AGREEMENT
This License Agreement (including any addendum or amendment to this
License Agreements which is included with the Software) are the entire
agreement between you and ActiveXperts relating to the Software and the
support services (if any) and they supersede all prior or
contemporaneous oral or written communications, proposals and
representations with respect to the Software or any other subject matter
covered by this License Agreement. To the extent the terms of any
ActiveXperts policies or programs for support services conflict with the
terms of this License Agreement, the terms of this License Agreement
shall control.
This Agreement shall be construed in accordance with the laws of The
Netherlands and the Dutch courts shall have sole jurisdiction in any
dispute relating to these conditions. If any part of these conditions
shall be or become invalid or unenforceable in any way and to any extent
by any existing or future rule of law, order, statute or regulation
applicable thereto, then the same shall to the extent of such invalidity
or enforceability be deemed to have been deleted from the conditions
which shall remain in full force and effect as regards all other
provisions.
9. Copyright
The Software is protected by copyright and other intellectual property
laws and treaties. ActiveXperts or its suppliers own the title,
copyright, and other intellectual property rights in the Software. The
Software is licensed, not sold.