VESOFT had a program to do this, but it doesn't come with the basic MPEX package. It's actually part of VEAUDIT. So one day I had to add 800 or 900 users into a new account, and it just so happened that the same exact users already existed in another account, so I wrote this command file. It was quicker than adding all these users manually ;-)
You can have it, but I recommend that you run it in "action="DISPLAY" mode first, see the following cmd file:
Parm action="#" capability="#" fromacct="#" toacct="#" userset="#"
# -------------------------------------------- #
# C O P Y U S E R
#
# MPE/iX "CI" Script ( donot run this from MPEX )
#
If (('!fromacct' = '#') or ('!toacct' = '#') or ('!userset' = '#')) Then
Echo This command file has THREE required parameters:
Echo
Echo 1 FROMACCT, The name of the Account where
Echo the SOURCE user names will be taken from.
Echo ( NO CHANGES WILL BE MADE TO THIS ACCOUNT )
Echo
Echo 2 TOACCT, The name of the account where the
Echo NEWUSER's will be created.
Echo
Echo 3 USERSET, This is user name to be copy from
Echo the Fromacct. Wildcards may be used, keeping
Echo in mind that all MPE's wildcard rules apply.
Echo
Echo Optionally TWO more parameters may be applied:
Echo
Echo 1 CAPABILITY, CAP=, for all user created.
Echo If this parm is omitted, then the SOURCE
Echo user's CAP= list will be used.
Echo
Echo 2 ACTION, By default is set to 'FILE', however it may
Echo set it to 'DISPLAY', 'EXECUTE', 'FILE', or 'ALL'.
Echo
Echo DISPLAY Will display the MPE commands to the
Echo $STDLIST, and can be redirected to a
Echo disc file to be reviewed/executed later.
Echo FILE Will write all NEWUSER commands to a
Echo DISC FILE, you will be prompted for the
Echo name of the disc file.
Echo EXECUTE Will execute the copy online, NOW!
Echo ALL Will do all of the above.
RETURN
Endif
# Author: Michael Anderson.
# Date: 2/3/99
# --------------------------------------------- #
#
Setvar prompt4fname false
If ( '!action' = '#') then
Setvar ACTION = 'FILE'
Endif
#
If ('!ACTION' = 'FILE') or ('!ACTION' = 'ALL') Then
SETVAR PROMPT4FNAME TRUE
SETVAR filename '#'
Endif
While ( PROMPT4FNAME = TRUE) do
Input filename;prompt="File name? "
If ((alpha('![str(filename,1,1)]') = false ) OR &
( alphanum('!filename') = false )) then
echo !filename is not valid
echo Enter file name only, exclude group and/or account.
echo
Else
Setvar flen len('!filename')
Endif
If (flen > 8) then
setvar fname str('!filename',1,8)
Else
Setvar fname str('!filename',1,!flen)
Endif
If (finfo('!fname','exists') = true) then
Setvar flen 0
Echo
Echo Unable to use !fname
Echo Because !fname alreadly exists as a file in the !hpgroup group.
Echo
Echo If you want to use !Fname you will need to
Echo use BREAK and ABORT, then manually PURGE !Fname
Echo Or enter a file name that doesn't exists.
Echo
Endif
#Echo flen is: !flen
If (flen > 0) then
Setvar PROMPT4FNAME FALSE
Endif
Endwhile
#
If ('!ACTION' = 'FILE') or ('!ACTION' = 'ALL') Then
purge !fname > $null
build !fname;rec=-255,1,f,ascii;disc=32767
file xout=!fname,old
Echo NEWUSER commands will be copied to a file named: !Fname
Endif
Purge stduser1 > $null
Build stduser1;rec=-133,1,f,ascii;dev=disc;disc=900000;msg
File x=stduser1,old
Listuser !userset.!fromacct ;pass;format=detail > *x
Setvar _eof finfo('stduser1','EOF')
Setvar _nbr_of_users 0
Setvar _processed_users 0
Setvar _err_processed 0
Setvar _holding_data false
While (!_eof > 0 ) do
Setvar _eof (!_eof - 1)
Input fuser1 < *x
setvar _dataitem str('!fuser1',1,3)
# echo !_dataitem
If ( '!_dataitem' = '***' ) And ( _holding_data = True)
Setvar _holding_data False
Setvar _processed_users (!_processed_users + 1)
Setvar _mpecmd 'NEWUSER !userdot1_name!toacct'
# Setvar _mpecmd '!_mpecmd'+';PASS=!userpass1_name'
Setvar _mpecmd '!_mpecmd'+';CAP=!usercapa1_name'
Setvar _mpecmd '!_mpecmd'+';HOME=!userhome1_name'
If ('!ACTION' = 'DISPLAY') or ('!ACTION' = 'ALL') Then
Echo !_mpecmd
Endif
If ('!ACTION' = 'FILE') or ('!ACTION' = 'ALL') Then
Echo !_mpecmd >> *xout
Endif
If ('!ACTION' = 'EXECUTE') or ('!ACTION' = 'ALL') Then
!_mpecmd
Endif
Endif
If ( '!_dataitem' = 'USE' ) Then
Setvar _holding_data True
Setvar _nbr_of_users (!_nbr_of_users + 1)
Setvar fuser2 str('!fuser1',14,18)
Setvar useracct1_len pos(' ','!fuser2',1) - 1
Setvar useracct1_name str('!fuser2',1,!useracct1_len)
Setvar userdot1_len pos('.','!fuser2',1)
Setvar userdot1_name str('!fuser2',1,!userdot1_len)
# Echo USER=!userdot1_name!toacct
Endif
If ( '!_dataitem' = 'HOM' ) Then
Setvar fuser0 str('!fuser1',14,20)
Setvar userhome1_len1 pos('/','!fuser0',-1) + 1
Setvar userhome1_len2 pos(' ','!fuser0',1) - 1
Setvar userhome1_name str('!fuser0',!userhome1_len1,!userhome1_len2)
# Echo HOME=!userhome1_name
Endif
If ( '!_dataitem' = 'PAS' ) Then
Setvar fuser3 str('!fuser1',14,8)
Setvar userpass1_len pos(' ','!fuser3',1) - 1
Setvar userpass1_name str('!fuser3',1,!userpass1_len)
# Echo PASS=!userpass1_name
Endif
If ( '!_dataitem' = 'CAP' ) Then
Setvar fuser4 str('!fuser1',14,80)
Setvar usercapa1_len pos(' ','!fuser4',1) - 1
Setvar usercapa1_name str('!fuser4',1,!usercapa1_len)
If ('!capability' <> '#') then
Setvar usercapa1_name '!capability'
Endif
# echo CAP=!usercapa1_name
Endif
Endwhile
If ( _holding_data = True)
Setvar _holding_data False
Setvar _processed_users (!_processed_users + 1)
Setvar _mpecmd 'NEWUSER !userdot1_name!toacct'
# Setvar _mpecmd '!_mpecmd'+';PASS=!userpass1_name'
Setvar _mpecmd '!_mpecmd'+';CAP=!usercapa1_name'
Setvar _mpecmd '!_mpecmd'+';HOME=!userhome1_name'
If ('!ACTION' = 'DISPLAY') or ('!ACTION' = 'ALL') Then
Echo !_mpecmd
Endif
If ('!ACTION' = 'FILE') or ('!ACTION' = 'ALL') Then
Echo !_mpecmd >> *xout
Endif
If ('!ACTION' = 'EXECUTE') or ('!ACTION' = 'ALL') Then
!_mpecmd
Endif
Endif
Echo Users found: !_nbr_of_users
Echo Users processed: !_processed_users
:
_________________________________
Michael Anderson
Student Services Programmer/Analyst
Spring Independent School District, Houston, Texas, 77090
281.586.1105
>>> Michael Hone <[log in to unmask]> 05/11 4:49 PM >>>
Hello All,
I want to copy a selection of users from one account to another with
passwords and caps intact. How can this be done?
Thanks in advance,
Michael
|