Many device configuration tasks require a script to enter a privileged mode in order to execute the necessary device commands. On many devices, privileged mode is entered using the "enable" command. Typically, running the "enable" command on a device requires the user to enter a user name and/or password. For devices that implement this style of "enable" command, scripts can use the WhatsConfigured @enable
command to easily enter privileged mode. The @enable
command has no parameters, and is invoked as follows:
@enable
When the @enable
command is executed, it does the following:
CommandTerminator
.serNamePrompt
, it sends Settings.UserName
to the device followed by CommandTerminator
.PasswordPrompt
, it sends Settings.PrivilegedPassword
to the device followed by CommandTerminator
. If Settings.PrivilegedPassword
is empty, it uses Settings.Password
instead.@enable
detects CommandPrompt
, it assumes that enable was successful. Otherwise, it assumes that enable failed.If at any time the device's output stalls for more than Settings.ReadTimeout
seconds, it is assumed that something is wrong, and the script returns failure.