How to open more than 1000 SSH sessions at one click using PuTTY? - windows

I want to open 1000 SSH sessions from remote server using PuTTY in Windows 10 for test purposes. How to do that in an easy way?

You can use a batch file like this:
for /l %%N in (1 1 1000) do putty.exe -load "your session"
Based on: How to execute one line multiple times using windows batch file?

Related

putty send command via a script and capture the output

We have a service that we can connect via putty over telnet. I am trying to automate a process for which I need to connect to service and execute / capture command(s) and then exit - however the issue is that that server expects a '\r\n' keystroke immediately after connect / before it takes any command as input:
c:\test>putty.exe -load mysession -m .\commands.txt
I tried many ways but I was unable to do so thru commands.txt
Is there a way we can say send ENTER key via a script to putty?

Run a batch file 5 minutes after startup in Windows Xp

I want to execute a .bat file 5 minutes after windows starts up. Unfortunately, windows task scheduler doesn't offer anything of the sort, only execute something right on start up. However, I need something to be 5 minutes after startup.
.bat file doesn't do much, just calls one separate .cmd file and passes a parameter. I've tried:
timeout /t 300 /nobreak
"C:\Documents and Settings\Administrator\Desktop\sikuli\runIDE.cmd" -r "C:\Documents and Settings\Administrator\Desktop\sikuli\SikuliXmlTestRunner.sikuli"
However, the runIDE.cmd gets called right away, regardless of the timeout.
You can give wait(300) command at the beginning in your sikuli script to achieve this.
XP doesn't have timeout command, use ping -n 300 localhost>nul or ping -n 1 -w 300000 localhost>nul.

I would like to create a batch script to run an already made bat script, delay for a few seconds and then type some commands

Need some help with this one (I'm new to batch scripting). So here's the problem:
I have a batch file called connection.bat:
- it connects to a network WiiU console, but it takes a few seconds to load the environment
- after it loads, it looks something like this:
#userid:
- that's when you can type some specific console commands (install and run mostly)
I want to make a batch file that does the following:
1. runs connection.bat
2. waits for it to finish loading the environment
3. and then type the install command
I tried doing it this way:
cd C:\test\connection.bat install -1 10.xx.xx.xx testupload.pkg
but it doesn't work, because it needs to connect first to the console
Is there a way to do this?
I always use ping to add a delay in batch files:
ping 0.0.0.0 > nul
adds a 3 second delay

Automatically connect to FTP server using batch commands, continue with batch script and then run FTP commands when necessary

Here's what I wish to do. Is it possible using a batch (Windows XP) file?
Prompt user to login to a FTP server.
Carry on with the rest of the batch commands, whilst keeping the FTP session/login alive.
Use the FTP PUT command when required with a batch command.
No, I cannot think of a way to keep the ftp process alive while continuing to run the batch file, and sending commands to the ftp process.
However, if this fits your needs, your batch file can collect all the data it needs first, generate a file containing all the ftp commands, then pass that file to ftp.exe as a last step.
For example:
SET /P ftpuser=Username:
SET /P ftppass=Password:
:: generate ftp script file
ECHO %ftpuser% > ftpcommands.txt
ECHO %ftppass% >> ftpcommands.txt
ECHO put file.txt >> ftpcommands.txt
ECHO quit >> ftpcommands.txt
:: now call ftp and have it process all the commands
ftp -s:ftpcommands.txt server.com
Windows ftp supports batch processing with its -s switch. However, there is no good way to keep an FTP session alive while waiting for more commands. The ftp command will process its -s script from start to finish and then exit.
Other than having the batch script generate the script used by ftp -s and running it as needed, the only solution I can think of would be to map the FTP server as a drive letter and copy as needed.

User session timeout force logoff

I have been doing a little research on how to make a script using vbs or batch to set a session time limit for users logging onto a specific set of computers linked through Group Policy.
I am not familiar with log off or timed scripts, I can make the simplest batch script to log the current user off a machine. The problem I get to is not being able to set a timed session, or running the log-off script due to the time limit.
I researched setting it through group policy, then came up with the idea of linking a script to a group policy in the start up for users on the certain set of computers.
I found a vbs by googling key phrases but I am not sure exactly how to implement it with the log off script or how to make it begin its count down
echo.
echo Waiting For thirty minutes...
TIMEOUT /T 1800 /NOBREAKS
echo.
echo (logoff)
echo.
pause >nul
The log off script that I was planning on using goes along the lines of:
shutdown -l -f -t 30 -c "Your 30 minute session is over."
But I cant get the comment to display and the 30 second time doesn’t take affect.
Any help would be greatly appreciated. Thank you for reading.
How about somthing like this?
Set oSystems = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
For Each oSystem in oSystems
oSystem.Win32ShutdownTracker 3600,"Logging off...",0,4
Next
I know this question is old but here you go anyway:
have a .vbs file called invis.vbs and place it in the Startup directory of the user you want to be limited.
It should contain the following (replace #username# with the Username):
wscript.exe “C:\Users\#username#\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Start-up\invis.vbs” “C:\SessionLimit.bat”
Now save the below as a batch file called SessionLimit.bat in the C:\ Directory.
It should contain the following:
#echo off
timeout 1800 /nobreak
shutdown /l ;;Replace this comment with /f if you want the log off to be forced without the Do you want to save your work interruption window.

Resources