View Single Post
  #7  
Old 09-16-2020, 05:58 PM
kdmorse kdmorse is offline
Registered User
 
Join Date: Feb 2018
Posts: 14
Quote:
Originally Posted by sussington View Post
I was wonding if there is a way I can have SecureCRT gather that information automaically from the OS or and NTP (for example)and then I can set that information in a command format via a button.
I had a script lying around that essentially does just that, and you can bind it to a button for convenience:

setclock.py

Code:
# $language = "Python"
# $interface = "1.0"

from datetime import datetime

def Main():

    CRT = crt
    Screen = CRT.Screen
    Screen.Send("config term\r")

    Now = datetime.now()
    Formatted = Now.strftime("%H:%M:%S %d %b %Y")
    Screen.Send("clock set " + Formatted + "\r")

Main()
Example:

Code:
MDS9710# config term
Enter configuration commands, one per line.  End with CNTL/Z.
MDS9710(config)# clock set 19:55:37 16 Sep 2020
Wed Sep 16 19:55:37 EDT 2020
MDS9710(config)#
The code should be straightforward enough that you can adjust it to taste with minimal effort.
Reply With Quote