How to add users to the Internal DB using a Windows Batch file ?
This article will have a focus on adding users to the Internal Database of the controller using a Windows Batch file.
There are occasions when we need to add multiple users to the internal database of the controller , but adding too many users manually would be little inconvenient , hence we can do it in a easier way by Assembling the user credentials into a text file and use a script file to add those credentials to the internal database of the controller.
So lets write a script which on executing will open a new PuTTY session to a certain IP Address and have it automatically enter your username for you and add the users to the internal database of the controller , the program that we use for this is "plink" which is the command line interface for Putty and can be used in scripts.
Environment : This article applies to Aruba Mobility Controllers running ArubaOS version 188.8.131.52 and above.
Copy the below commands on a notepad and save it as internaldb.bat
C:\plink.exe <username>@<x.x.x.x> -pw <password> <com.txt
In order to automatically run commands without interaction, the commands you want to run need to be inserted into a text file "com.txt"
|local-userdb add username <username1> password <password1>
local-userdb add username <username2> password <password2>
local-userdb add username <username50> password <password50>
Keep the internaldb.bat , com.txt and plink.exe on the same directory and execute the bat file
open up a command prompt, black screen comes up. Drag and drop your .bat file onto the window. If that doesnt work use cd (change directory) to go to where the file is and then press enter.
C:\plink.exe firstname.lastname@example.org -pw aruba123 <com.txt
- Use ssh to connect
- Connect with the username admin
- The IP address of the device we are connecting is 10.30.156.14
- use the password aruba123
- run the commands contained in the file called com.txt that resides in the current directory.
Contents of com.txt file :
local-userdb add username testprog1 password testprog1
local-userdb add username testprog2 password testprog2
local-userdb add username testprog50 password testprog50