Using Expect-Lite Scripts to Perform a Login
From TDiWiki
Expect-Lite Scripts can be used to perform the login process on Telnet and SSH Consoles connecting to devices such as HP iLOs. Follow these steps to ensure proper configuration:
- From a command prompt on the computer where ConsoleWorks is running, perform the login process on the target system by hand.
- Using copy and paste,
- capture each prompt such as Password:
- capture each response
- make sure to capture character case correctly.
- From the ConsoleWorks main menu, click Expect-Lite Scripts > Add
- Give the new script a meaningful name and description
- Construct a script that should look something like:
EXPECT MP username: SEND username\x0a EXPECT MP password: SEND password\x0a
Where MP username: is a username prompt that you are expecting to which you send a username and so on.
The username and password indicated on the SEND lines above can be stings in the script itself or they can be parameters. To make them parameters replace the string with a parameter such as ${usernameparameter}. See the ConsoleWorks online help for further help with Expect-Lite parameters.
Note that the \x0a represents a line-feed character that most systems will recognize as an end of line character. On some systems, a carriage return character (\x0d) might be required instead.
