Script Telnet (bat) récupérer informations

Waldner11 Messages postés 2 Date d'inscription lundi 22 juin 2009 Statut Membre Dernière intervention 22 juin 2009 - 22 juin 2009 à 10:25
Waldner11 Messages postés 2 Date d'inscription lundi 22 juin 2009 Statut Membre Dernière intervention 22 juin 2009 - 22 juin 2009 à 10:26
Je dois faire un inventaire des Neoware d'une société et pour y accéder, je dois passer par le telnet. Seulement j'ai plusieurs petits problèmes pour automatiser la connexion et la récupération d'informations.
1- tgatecommand2 (la variable est trop longue)
2- Je voudrais récupérer le résultat des deux premières commandes dans un fichier texte.
(le script ci-dessous)

del telnet.vbs
Dim tgatecommand2 As String
@set tgateboxip=10.45.100.42
@set tgateusername=root
@set tgatepassword=admin
@set tgatecommand1=cat /tmp/HOSTNAME
@set tgatecommand2=regMgr -l -r "/tmp/config/sys/sysinfo.ini" -k "Sysinfo/Hw" -i "serialNumber"
@set tgatecommand3=exit
@start /realtime telnet.exe %tgateboxip%
@echo set sh=WScript.CreateObject("WScript.Shell")>>telnet.vbs
@echo WScript.Sleep 500>>telnet.vbs
@echo sh.SendKeys "%tgateusername%">>telnet.vbs
@echo WScript.Sleep 500>>telnet.vbs
@echo sh.SendKeys "~">>telnet.vbs
@echo WScript.Sleep 500>>telnet.vbs
@echo sh.SendKeys "%tgatepassword%">>telnet.vbs
@echo sh.SendKeys "~">>telnet.vbs
@echo WScript.Sleep 500>>telnet.vbs
@echo sh.SendKeys "%tgatecommand1%">>telnet.vbs
@echo sh.SendKeys "~">>telnet.vbs
@echo WScript.Sleep 500>>telnet.vbs
@echo sh.SendKeys "%tgatecommand2%">>telnet.vbs
@echo sh.SendKeys "~">>telnet.vbs
@echo WScript.Sleep 500>>telnet.vbs
@echo sh.SendKeys "%tgatecommand3%">>telnet.vbs
@echo sh.SendKeys "~">>telnet.vbs
@echo WScript.Sleep 500>>telnet.vbs
@cscript //nologo telnet.vbs
del telnet.vbs

1 réponse

Waldner11 Messages postés 2 Date d'inscription lundi 22 juin 2009 Statut Membre Dernière intervention 22 juin 2009
22 juin 2009 à 10:26
(désolé pour la mise en forme du script)
0
Rejoignez-nous