Hi @Tas
I have tried with both, but no use.
Script:
import paramiko
#Below line will initiate an object for ssh connectivity.
p = paramiko.SSHClient()
#Below line will open a the credential file in read mode where we have credential fo the devices.
cred = open("cred.csv","r")
#Now below is the for loop which will iterate over each line of the file and get the credential, login to the device and execute a command. Then the output of the command for each device will be saved in a text file.
for i in cred.readlines():
line=i.strip()
ls =line.split(",")
print(ls)
p.set_missing_host_key_policy(paramiko.AutoAddPolicy())
p.connect("%s"%ls[0],port =22, username = "%s"%ls[1], password="%s"%ls[2])
stdin, stdout, stderr = p.exec_command("vserver cifs session show -idle-time \>=1d")
opt = stdout.readlines()
opt ="".join(opt)
print(opt)
temp=open("%s.txt"%ls[0],"w")
temp.write(opt)
temp.close()
cred.close()
I have tried above script with \ and with out \, but i got error like below.
