Reply

NetMRI script not working

New Member
Posts: 2
3173     0
Hi all,

Am having trouble to change the password for juniper devices by using below script , it is not working kindly help me


# BEGIN-SCRIPT-BLOCK
#
# Script-Filter:
# $Vendor in ["Juniper", ]
#
# Script-Variables:
# $username word "su"
# $password password "simple123"
#
#
# END-SCRIPT-BLOCK

use strict;
use warnings;
use NetMRI_Easy 0.6;

our $username;
our $password;


my $easy = new NetMRI_Easy({ api_version => 2.5 });

if($easy->vendor eq "Juniper") {
$easy->send_command("configure");
$easy->send_command("set system login user $username authentication plain-text-password”, “password:”);
$easy->send_command($password);
$easy->send_command("show | compare");
$easy->send_command("commit");
$easy->send_command("exit");
}

Re: NetMRI script not working

Superuser
Posts: 115
3174     0

Try this one

 

###########################################################################
## Export of Script: JuniperPassword
## Script-Level: 3
## Script-Category: Config
###########################################################################

Script:
	JuniperPassword

Script-Description:
	This script  updates the nccm account password on Juniper devices.

Script-Filter:
	$Vendor eq "Juniper"

# Will not work currently - Trigger-Context-Password currently only accepts a
# static value (i.e. passing a variable to Trigger-Context-Password will not work)
#script-variables:  (in lower case to avoid GUI accidently picking this up
#	$password	password	""

##################################################

Action:	Set Juniper Root Password

Action-Description:
	This script updates the root password on Juniper devices.  Needs password hard coded in script.

Action-Commands:
	configure

Output-Triggers:
	SetPassword

##################################################

Trigger:	SetPassword

Trigger-Filter:
        true

Trigger-Context:
        true

Trigger-Context-Enter:
        set system login user nccm authentication plain-text-password

Trigger-Context-Password:
# Change InsertYourPasswordHere on the following line to the desired password
# for the nccm account.
        InsertYourPasswordHere

Trigger-Commands:
        commit

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com
Showing results for 
Search instead for 
Did you mean: 

Recommended for You