Operating System - OpenVMS
1827809 Members
2052 Online
109969 Solutions
New Discussion

Re: Anyone have a simple script to list all users by account?

 
Victor Mendham
Regular Advisor

Anyone have a simple script to list all users by account?

I'm looking for a simple script to query the UAF file for all users by /account.

Anyone have one?

Vic
12 REPLIES 12
Ian Miller.
Honored Contributor

Re: Anyone have a simple script to list all users by account?

theres a utility called UAF which is good for this sort of thing. See
ftp://ftp.process.com/vms-freeware/fileserv/uaf.zip
or
ftp://ftp.process.com/vms-freeware/fileserv/scanuaf.zip

Martin can probably write on in perl :-)
____________________
Purely Personal Opinion
John Eerenberg
Valued Contributor

Re: Anyone have a simple script to list all users by account?

Vic,

As you have no doubt discovered, the show command in authorize does not have a /account capability.

If a brief listing is okay, then use the following:

$ set default sys$system
$ define/user sys$output sys$login:a.txt
$ mcr authorize show/brief *
$ sort sys$login:a.txt-
/key=(num=1,pos=51,size=8)-
/key=(num=2,pos=22,size=15) sys$login:b.txt

b.txt will be your listing sorted by account field and usernames within that account field.

Hope it helps,

john
It is better to STQ then LDQ
Craig A Berry
Honored Contributor

Re: Anyone have a simple script to list all users by account?

Well, until Martin shows up, here's a quick and dirty one-liner in Perl. You might have to go to a few more lines if you have too many users per account to fit on one line or if you have an account name that sorts before the word "Account".

But the point here is that it's a fairly trivial string parsing exercise and shouldn't take long in whatever language your comfortable. Note that there's only one continuation line here and this may be wrapped:

$ pipe mcr authorize show/br * | perl -e -
"while (<>) {$a{substr($_,50,8)} .= (substr($_,21,12).' ');} for $k (sort keys %a) {print qq{$k $a{$k}\n};}"

Account Username
DECNET SCA$DEFAULT SCA$SERVER
DECNETV CML$SERVER MAIL$SERVER MIRRO$SERVER PHONE$SERVER VPM$SERVER
SYSTEM SYSTEM
TCPIP TCPIP$DHCP TCPIP$FTP TCPIP$NTP TCPIP$SMTP
Victor Mendham
Regular Advisor

Re: Anyone have a simple script to list all users by account?

Craig, This may sound a little strange, but I have no experience with Perl, so is there a free Perl library etc for Alpha & VAX, so that I can test your scripting?

Vic..
Martin P.J. Zinser
Honored Contributor

Re: Anyone have a simple script to list all users by account?

Hi,

well you were asking for it ;-) Since Craig already covered the filter approach, here is a variation using on of the many useful VMS Perl modules. Note: For the specific task at hand (account), this might be even slightly more complex than Craigs example, but the solution is much more general, since you can query pretty much all the fields of UAI that way. For a list of the supported fields and another example check the attached Zip archive.

TIMTOWTDI ;-)

use VMS::User;

@users = VMS::User::user_list();

printf "%-30s %-30s\n", "Username", "Account";
for($i=0;$i<=@users;$i++){
unless ($users[$i] eq "" or $users[$i] eq "Username"){
$uairef = VMS::User::user_info($users[$i]);
printf "%-30s %-30s\n", $users[$i], $uairef->{ACCOUNT};
}
}

VMS::User is available via CPAN (and part of the Perl on the latest freeware CD).

Cheers, Martin
labadie_1
Honored Contributor

Re: Anyone have a simple script to list all users by account?

if you install Python for Vms (vmspython.dyndns.org), you have an example (list an Uaf by username and by UIC order) at

http://vmspython.dyndns.org/docs/python_vms/reference_manual_003.html#bottom_003

search for
example_rms.py

A slight modification will give you what you want.

Regards

Gerard
Wim Van den Wyngaert
Honored Contributor

Re: Anyone have a simple script to list all users by account?

HP should assign someone to implement things like /select=account=SYSTEM in authorize. And this selectable for all fields.

And also in all other show commands availble in OpenVMS.

I dream of
$ show sys/sel=(cpu=min=10:00,account=ME*)

This makes /own /proc etc obsolete.
Wim
Jan van den Ende
Honored Contributor

Re: Anyone have a simple script to list all users by account?

Wim, you hit one of my favorites!

Speaking of UAF selections:

How about something like:

UAF> Modify * /param=value where param < value

or

UAF> Modify * /params=value where ident_held = IDname [ .AND. param < value ]

Of course max-values i.o. min-values also.

If the intro or change of an app requires upping some value, just UAF mod * will DEcrease the few accounts that need a still higher value for some other reason.
For a SYSUAF of > 10 K accounts doing a check & change for each account is really funny. ;-D

(we have some DCL for it, but is a REAL performance killer, and it is too heavily dependant on site-specific standards to be readily spread. For some months now I plan to find some low-activity hours to generalise it and put it into OPENVMS.DCL, but it proves not THAT simple, and more urgent things keep coming up)
:-)
I know, I know, SYSGEN PQL_Mxxx can help you, but that also has drawbacks.

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Ian Miller.
Honored Contributor

Re: Anyone have a simple script to list all users by account?

I use the UAF util I previously mentioned to generate a list of usernames based on selection criteria such as quotas then use that this to change things.
____________________
Purely Personal Opinion
Craig A Berry
Honored Contributor

Re: Anyone have a simple script to list all users by account?

Victor, there are several places to get Perl. Martin has mentioned the Freeware 6.0 CD:

http://h71000.www7.hp.com/openvms/freeware/

There is a PCSI kit for Alpha released by OVMS Engineering as part of their web serving suite:

http://h71000.www7.hp.com/openvms/products/ips/apache/csws_perl_relnotes.html

There are assorted binary kits from:

http://www.sidhe.org/vmsperl

or, if you have DEC C, you can build from source, which is available from

http://www.cpan.org/src/

To join a low-volume mailing list on the development and support of Perl on VMS, send mail to

vmsperl-subscribe AT perl DOT org
Martin P.J. Zinser
Honored Contributor

Re: Anyone have a simple script to list all users by account?

Hello Jan,

sounds reasonable, I shall see what I can do. This will not be ready before Monday though.

Greetings, Martin
Jan van den Ende
Honored Contributor

Re: Anyone have a simple script to list all users by account?

Martin,

ease down.
No hurry. We DO have a working DCL for it, and we need it maybe twice a year (btw, it does SHOW as well as MODIFY), but it is NOT (yet) fit for environments that do not conform to our standards.
For instance: it assumes that EVERY account-name is also an identifier with RESOURCE attribute, and a [nnnnn,*] UIC value;
every account HAS a named UIC of format [account-name,username]. THAT is we I didn't post it (yet).

Then again, maybe you SHOULD post it, I am not the only one that would profit :-)

Jan
Don't rust yours pelled jacker to fine doll missed aches.