ZmeYRRASEnum component
Installtion
Register component using regsvr32 ZmeYRRASEnum.dll.
License
This component is FREEWARE and can be distributed and used without any
permission.
General
ZmeYRRASEnum component implements operations related to controling RAS access and
control of the dial-in enabled ports on machines running Windows NT with Routing and RAS
(RRAS). This causes Windows 2000 too. On Windows NT 4.0 it can be used only for servers
running RRAS, on Windows 2000 it can work with any version. The control itself can run on
NT 4.0 workstations with SP4 but it can control remotely only NT servers with RRAS running
!
Usage
Component name is ZmeYRRASEnum i.e.create component's object
as follows:
Server.CreateObject("ZmeYRRASEnum.RRASServer") in ASP pages or
var ras = new ActiveXObject("ZmeYRRASEnum.RRASServer"); in
Windows Scripting Host scripts
RRASServer is the base object that you must create. It establishes connection to
the server and creates collection of port objects.
See additional usage notes at the bottom of this document.
Objects
| RRASServer | You will need one of this objects per every RRAS server managed by your script/application | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Properties:
Methods:
|
| RASPort | Never create this object directly ! Collection of RASPort objects is created by RRASServer object on connection | |||||||||||||||||||||||||||||||||||||||||||||
Properties:
|
Remarks
RRASServer object must run in the context of the NT account with administrative rights
! So if you going to create ASP pages - those pages will be useful only for the
administrators.
RRASServer object supports some switch user capabilities. Setting Username and
Password properties you can force object to use specified account for
connections. But this trick will not work if your object lives in the already switched
context ! Typical usage in ASP pages is a good example for this situation. In WSH scripts
context switching works fine because your script will start in your context. To use this
features base account (in wich script starts) must have SetTcbName privilege (Act as part
of operating system). You can grant privilege using Usermanager, but note that this can be
risky in some cases (depending to the security strategy of the system).
Typicaly you will need to call members of the RRASServer object in the following order:
1 - Connect() - to connect to server and create collection of the server ports
2 - Refresh() - to grab current state of ports (Connect will not fill port collection with
actual values).
.... Do something with RASPort objects, call other members ....
3 - Disconnect() - end connection to the server.
Package ships with WSH and ASP examples (in JScript)
Sample:
var port; var str; ras.Server = "MYSERVER"; ras.Connect();
function StrFormat(text,place) {
var str1 = new String(text);
while (str1.length < place) {
str1 += " ";
}
return str1;
}
if (ras.IsConnected == 1) {
WScript.Echo("Connected to the server: " + ras.Server );
WScript.Echo(" ");
str = StrFormat("PORT",8);
str += StrFormat("CONDITION",30);
str += StrFormat("USER",20);
str += StrFormat("IP",20);
WScript.Echo(str);
ras.Refresh();
for (i = 1; i <= ras.Count; i++) {
port = ras(i);
str = StrFormat(port.Name,8);
str += StrFormat(port.ConditionName,30);
str += StrFormat(port.Username,20);
str += StrFormat(port.IP,20);
WScript.Echo(str);
}
}
This WSH sample lists port status on MYSERVER.
ZmeY soft 1999