Jump to content

Recommended Posts

Posted

I am currently using the following simple script to run remote commands to Cisco ASAs with Plink and dumping them out to a text file.

dim $userName, $deviceAddress, $userPassword, $commandFile

$userName = Inputbox("userName", "Enter the device's userName :", "")
$userPassword = Inputbox("userPassword", "Enter the device's Password :", "", "*")
$deviceAddress = Inputbox("deviceAddress", "Enter the device's Address :", "")
$commandFile = Inputbox("commandFile", "Enter the Command file :", "command.txt")
$outputFile = Inputbox("outputFile", "Enter the Output file :", "output.txt")

Run(@ComSpec & " /c " & "C:\plink\plink.exe -ssh -l " & $username & " -pw " & $userPassword & " -m " & $commandFile & " " & $deviceAddress &  " > " & $outputFile, "", @SW_HIDE)

The $commandFile looks like this:

enable

Password

show start

exit

This works perfectly for what I am doing one device at a time but I am looking at scripting this for all our customers, which is over 200 devices. Is there any way to create a text file on the fly for the $commandFile so that I can use a variable for the enable password? I'm not familiar with GUIs but my vision would include an input area where the commands could be typed and just run from that.

Thanks.

Posted

I am currently using the following simple script to run remote commands to Cisco ASAs with Plink and dumping them out to a text file.

dim $userName, $deviceAddress, $userPassword, $commandFile

$userName = Inputbox("userName", "Enter the device's userName :", "")
$userPassword = Inputbox("userPassword", "Enter the device's Password :", "", "*")
$deviceAddress = Inputbox("deviceAddress", "Enter the device's Address :", "")
$commandFile = Inputbox("commandFile", "Enter the Command file :", "command.txt")
$outputFile = Inputbox("outputFile", "Enter the Output file :", "output.txt")

Run(@ComSpec & " /c " & "C:\plink\plink.exe -ssh -l " & $username & " -pw " & $userPassword & " -m " & $commandFile & " " & $deviceAddress &  " > " & $outputFile, "", @SW_HIDE)

The $commandFile looks like this:

enable

Password

show start

exit

This works perfectly for what I am doing one device at a time but I am looking at scripting this for all our customers, which is over 200 devices. Is there any way to create a text file on the fly for the $commandFile so that I can use a variable for the enable password? I'm not familiar with GUIs but my vision would include an input area where the commands could be typed and just run from that.

Thanks.

I'm not familiar with Plink at all. However it sounds as if your looking to build a GUI that would allow you to selected a login and go. (a one click solution). It seems as if the command file is needed for the login, but I see no reason the file couldn't be produced on the fly to login. Perhaps using a listbox or combo box for the gui list then using one of the fileopen/ filewrite /filewriteline to write the temp command file and then delete is when done. Seems completely possible. I'd start with one of the sample GUI's from the help file and build on it from there.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...