Create New Magento admin User programmatically

Suppose you want to create the new Magento admin User programmatically via using the Code in Magento, its very easy and you can create the new Magento admin from the steps given below

Step 1 : Just Connect your FTP and navigate to the root of the Magento, means where Magento is installed / setup.
Step 2 : Create a PHP file and here I have created the customer_create.php
Step 3 : Now Copy the code below and Save

# Create New admin User programmatically.


try {
$user = Mage::getModel('admin/user')->setData(array(
		'username' => 'admin2017',
		'firstname' => 'EWA',
		'lastname'    => 'Admin',
		'email'    => '',
		'password' =>'admin@2017',
		'is_active' => 1

} catch (Exception $e) {
	echo $e->getMessage();

//Assign Role Id
try {
	$user->setRoleIds(array(1))  //Administrator role id is 1 ,Here you can assign other roles Ids.

} catch (Exception $e) {
	echo $e->getMessage();

echo "User has been created successfully.";


As you all aware of the Magento version Upgrade, why we need to upgrade the Magento version from old version to the upgraded version, Please here Why and How we can upgrade the Magento Version?

Stay tuned for the Magento and Magento2 latest tutorial and updates, Hope you enjoyed reading, if you need the professional Magento Development we can help you, just Click on the Link and send me your requirements.