Over the last few months, I’ve been working a project where I’ve started to dive into EM CLI and the value that EM CLI brings to cutting down on doing things like creating Enterprise Manager users. Hence the reason for this post.
Creating users in Enterprise Manager 12c is pretty simple as it is. Simply go to Setup -> Security -> Administrators. When you get this screen, then click on either the Create or Create Like buttons.
After clicking Create or Create Like, Enterprise Manger takes you to a five (5) step wizard for creating a user. This wizard allows you to provide details about the user, assign roles, assign target privileges, assign resource privileges and then review what you have done.
Depending on how many users you have to create, this wizard is either an great way of creating user or a slow way for creating users. Using EM CLI, users can be created from the command line very quickly and easily and no need to use the GUI wizard either.. 🙂
The syntax to create a user from the command line is as follows:
The beautiful part of EM CLI is that is can be used with any scripting language. Since I like to use PERL, I decided to write a simple script that can be used to create a user from the command line using EM CLI.
my $oem_home_bin = “$OMS_HOME/bin";
my ($username, $passwd, $email) = @ARGV;
my $pwdchange = ‘false’;
if (not defined $username or not defined $passwd or not defined $email)
print "\nUsage: perl ./emcli_create_em_user.pl username password email_address\n\n";
system($oem_home_bin.’/emcli login -username=sysman);
my $cmd = ’emcli create_user -name=’.$username.’ -password=’.$passwd.’ -email=’.$email.’ -prevent_change_password=’.$pwdchange;
Now using this bit of code, I’m able to create users very rapidly using EM CLI with a command like this:
perl ./emcli_create_em_user.pl <username> <password for user> <email address>
Well, I hope this helps other look at and start using EM CLI when managing their EM environments.