Configuration

Configuration

Configuration
Configuration
2025-03-26 00:28:52
Model: TL-SX3206HPP  
Hardware Version: V1
Firmware Version: 1.20.0

Greetings,

 

I am attempting to automate the configuration of the above switch. I have been trying to build a batch file or powershell script to:

 

-log into the router

-turn on/off the POE in port 4

 

I have managed to automate the connection to the switch using plink and ssl. I cannot, however, get past this message - Access granted. Press Return to begin session. - which prints once the connection is established. 

 

I can do the rest of the input to access the interface and port(s) manually, however, I want to do this remotely. It is not a sceduled thing so that won't work.

 

Any help would be appreciated.

 

Thanks,

Graham

  0      
  0      
#1
Options
3 Reply
Re:Configuration
2025-03-26 02:40:16

Hi @gfd29 

Thanks for posting in our business forum.

Not sure what you are talking about here.

gfd29 wrote

Greetings,

 

I am attempting to automate the configuration of the above switch. I have been trying to build a batch file or powershell script to:

 

-log into the router

-turn on/off the POE in port 4

 

I have managed to automate the connection to the switch using plink and ssl. I cannot, however, get past this message - Access granted. Press Return to begin session. - which prints once the connection is established. 

 

I can do the rest of the input to access the interface and port(s) manually, however, I want to do this remotely. It is not a sceduled thing so that won't work.

 

Any help would be appreciated.

 

Thanks,

Graham

Log in to the router?

Do you enter the privileged mode?

What's the Access Granted you are talking about? Screenshot?

Best Regards! If you are new to the forum, please read: Howto - A Guide to Use Forum Effectively. Read Before You Post. Look for a model? Search your model NOW Official and Beta firmware. NEW features! Subscribe for the latest update!Download Beta Here☚ ☛ ★ Configuration Guide ★ ☚ ☛ ★ Knowledge Base ★ ☚ ☛ ★ Troubleshooting ★ ☚ ● Be kind and nice. ● Stay on the topic. ● Post details. ● Search first. ● Please don't take it for granted. ● No email confidentiality should be violated. ● S/N, MAC, and your true public IP should be mosaiced. ● I don't provide ETA for any products/features. No comment.
  0  
  0  
#2
Options
Re:Configuration
2025-03-26 17:06:51

  @gfd29 

Thanks for the reply Clive. Sorry I sent so little info the first time.

 

Objective:

Automatically log into the TL-SX3206HPP switch and send the necessary commands to turn on POE on port 4.

 

Batch file commands:

@echo off
plink -v 192.168.50.110 -l admin -pw mypassword < e:\Desktop\CLIcommands.txt
PAUSE ***I added the pause so I could capture the output***

 

Command text file content:

enable

 

config

 

interface ten-gigabitEthernet 1/0/4

 

power inline supply disable

 

end

 

exit

 

exit

 

I am happy to report that this worked. The device turned on. I was also able to get the result I was after by going this route:

 

(
echo enable
echo config
echo interface ten-gigabitEthernet 1/0/4
echo power inline supply disable
echo end
echo exit
echo exit
echo disconnect
) | plink -v 192.168.50.110 -l admin -pw fjk6WAQ.thb5kgb!neq -P 22

 

Here is the output:

 

Looking up host "192.168.50.110" for SSH connection

Connecting to 192.168.50.110 port 22

We claim version: SSH-2.0-PuTTY_Release_0.83

Connected to 192.168.50.110 (from 192.168.50.187:50806)

Remote version: SSH-1.99-IPSSH-6.6.0

Using SSH protocol version 2

No GSSAPI security context available

Doing Diffie-Hellman key exchange using 4096-bit modulus and hash SHA-512 (unaccelerated) with standard group "group16"

Server also has ssh-dss host key, but we don't know it

Host key fingerprint is:

ssh-rsa 1024 SHA256:6axN9M10pB/8jUcmzZ0aA897z5n9ObiIaT/+NCbNlyk

Initialised AES-256 SDCTR (AES-NI accelerated) outbound encryption

Initialised HMAC-SHA-256 (SHA-NI accelerated) outbound MAC algorithm

Initialised AES-256 SDCTR (AES-NI accelerated) inbound encryption

Initialised HMAC-SHA-256 (SHA-NI accelerated) inbound MAC algorithm

Using username "admin".

Further authentication required

Further authentication required

Sent password

Access granted

Opening main session channel

Opened main channel

Allocated pty

Started a shell/command

 

SX3206HPP>enable

Main session channel closed

Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 256

FATAL ERROR: Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 256

Press any key to continue . . .

 

Can you tell from the output, wheren I could have done this better? I see that "Further authentication required" shows twice. Also, the last messages look like I may not have disconnected properly:

 

Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 256

FATAL ERROR: Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 256

 

I would be grateful for any further guidance you could provide.

 

Thanks,

Graham

 

  0  
  0  
#3
Options
Re:Configuration
2025-03-27 01:43:10

Hi @gfd29 

Thanks for posting in our business forum.

gfd29 wrote

  @gfd29 

Thanks for the reply Clive. Sorry I sent so little info the first time.

 

Objective:

Automatically log into the TL-SX3206HPP switch and send the necessary commands to turn on POE on port 4.

 

Batch file commands:

@echo off
plink -v 192.168.50.110 -l admin -pw mypassword < e:\Desktop\CLIcommands.txt
PAUSE ***I added the pause so I could capture the output***

 

Command text file content:

enable

 

config

 

interface ten-gigabitEthernet 1/0/4

 

power inline supply disable

 

end

 

exit

 

exit

 

I am happy to report that this worked. The device turned on. I was also able to get the result I was after by going this route:

 

(
echo enable
echo config
echo interface ten-gigabitEthernet 1/0/4
echo power inline supply disable
echo end
echo exit
echo exit
echo disconnect
) | plink -v 192.168.50.110 -l admin -pw fjk6WAQ.thb5kgb!neq -P 22

 

Here is the output:

 

Looking up host "192.168.50.110" for SSH connection

Connecting to 192.168.50.110 port 22

We claim version: SSH-2.0-PuTTY_Release_0.83

Connected to 192.168.50.110 (from 192.168.50.187:50806)

Remote version: SSH-1.99-IPSSH-6.6.0

Using SSH protocol version 2

No GSSAPI security context available

Doing Diffie-Hellman key exchange using 4096-bit modulus and hash SHA-512 (unaccelerated) with standard group "group16"

Server also has ssh-dss host key, but we don't know it

Host key fingerprint is:

ssh-rsa 1024 SHA256:6axN9M10pB/8jUcmzZ0aA897z5n9ObiIaT/+NCbNlyk

Initialised AES-256 SDCTR (AES-NI accelerated) outbound encryption

Initialised HMAC-SHA-256 (SHA-NI accelerated) outbound MAC algorithm

Initialised AES-256 SDCTR (AES-NI accelerated) inbound encryption

Initialised HMAC-SHA-256 (SHA-NI accelerated) inbound MAC algorithm

Using username "admin".

Further authentication required

Further authentication required

Sent password

Access granted

Opening main session channel

Opened main channel

Allocated pty

Started a shell/command

 

SX3206HPP>enable

Main session channel closed

Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 256

FATAL ERROR: Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 256

Press any key to continue . . .

 

Can you tell from the output, wheren I could have done this better? I see that "Further authentication required" shows twice. Also, the last messages look like I may not have disconnected properly:

 

Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 256

FATAL ERROR: Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 256

 

I would be grateful for any further guidance you could provide.

 

Thanks,

Graham

 

I don't help the script. You can send this to the GPT or something for code improvement.

 

A brief look at this, it does not seem to need improvements. About the problem, in normal manual mode, can you log in? If you can, that could be something related to the script. Command order?

Best Regards! If you are new to the forum, please read: Howto - A Guide to Use Forum Effectively. Read Before You Post. Look for a model? Search your model NOW Official and Beta firmware. NEW features! Subscribe for the latest update!Download Beta Here☚ ☛ ★ Configuration Guide ★ ☚ ☛ ★ Knowledge Base ★ ☚ ☛ ★ Troubleshooting ★ ☚ ● Be kind and nice. ● Stay on the topic. ● Post details. ● Search first. ● Please don't take it for granted. ● No email confidentiality should be violated. ● S/N, MAC, and your true public IP should be mosaiced. ● I don't provide ETA for any products/features. No comment.
  1  
  1  
#4
Options