Posts

Showing posts with the label Scripting

How to keep desktop awake

The following script will keep your desktop awake,It basically sends caps lock signal to the system periodically. Just copy the code and save it as a power shell (.ps1) file and execute it. If you face any permission issue''s while executing this , then simply open " Windows PowerShell ISE " and copy the code. <#Read Me: Developed By: Name:Vaneeswaran N www.vaneeswaran.com #> $myshell = New-Object -com "Wscript.Shell" for ( ;; ) { Start-Sleep -Seconds 60 $myshell.sendkeys( "{NUMLOCK}" ) }

how to automate Serial/Telnet/ssh Login Using TTL

This is a simple ttl script which is used to automate the login in serial/ssh/telnet To know more about ttl : https://vaneeswarann.blogspot.in/2018/02/how-to-write-a-simple-ttl-script.html ;------------------------------------------------------------------------ ; Developed By : ; Vaneeswaran N ; www . vaneeswaran . com ;------------------------------------------------------------------------ connect '/C=10' ; connect to com port 10 UsernamePrompt = 'login:' ; setting username prompt Username = 'root' ; variable to hold the username value PasswordPrompt = ' ' ; setting username prompt Password = 'admin@123' ; variable to hold the password ; running an infinite while loop so whenever login reboot happens it will b automatically logged in while 1 wait UsernamePrompt ; waiting for the userpromt sendln Username ; feeding the username once prompts wait PasswordPrompt ...

How to write a simple ttl script macro

Image
Tera Term is an open source terminal which is similar to putty. It supports a Script Language called " Tera Term Language " or " macro " which can be used to automate the CLI based user action. Using this script we can do a lot of automation. The beauty of this script are that these script will be running in host computer and commands are executed on the target.Which means even the target goes for reboot the scipt will be still running and even we can capture/ automate certain tasks which involves reboot.Also no matter whatever the target we can develop script as these scripts are running in the hosts (windows). Advantages over other scripting language; Target Platform Independent Able to continue to run even after reboot Changes in the target is not required Supported over serial,ssh,telnet connections. Executing a TTL Script   How to Use it: Establish a serial/telnet/ssh connection by setting up the baud rates.  Launch the ttl script by going t...

How to Create Folder Lock in windows

Create Your Own Folder Lock Step  1: Go to the folder where you wanna create a Your Own Folder Lock Step 2: Open a notepad and copy the given Code cls @ ECHO OFF title Folder Personal if EXIST "HTG Locker" goto UNLOCK if NOT EXIST Personal goto MDLOCKER :CONFIRM echo Enabling Lock ::Waiting for Conformation (y/n) set /p "cho=>" if %cho% == Y goto LOCK if %cho% == y goto LOCK if %cho% == n goto END if %cho% == N goto END echo Invalid choice . goto CONFIRM :LOCK ren Private "HTG Locker" attrib +h +s "HTG Locker" echo Folder locked goto End :UNLOCK echo Enter password to unlock folder set /p "pass=>" if NOT %pass% == mypassword goto FAIL attrib -h -s "HTG Locker" ren "HTG Locker" Personal echo ERR_INCORRECT_PASSWORD ::FOLDER UNLOCK FAILED goto End :FAIL echo Invalid password goto end :MDLOCKER md Personal echo Fo...

Touch command in powershell

The following power shell program is the similar to the Touch Command in Unix. It has the following features. create new file modify time stamp <#Read Me: Developed By: Name:Vaneeswaran N www.vaneeswaran.com #> $Function_Exit_Status = $false #Variable to store the exit status of the function function Touch_File ( $filename ) { $global:Function_Exit_Status = $false if (! [System.IO.File] ::Exists( $filename )) { echo "" > $filename $global:Function_Exit_Status = $true } else { $update = get-date try { Set-ItemProperty -Path $filename -Name LastWriteTime -Value $update $global:Function_Exit_Status = $true } catch { Log_Exception $( $_ .Exception.GetType().FullName) $( $_ .Exception.Message) $global:Function_Exit_Status = $false ...

Logger in Powershell

The below functions can be used as Logger and Exception Logger in power shell. The Logger function can be used to log the message in a file The Log_Exception function can be used to log the exception thrown at any try{} .. catch{} statements. The Test_Exception function is a driver function  < #Read Me: Developed By: Name:Vaneeswaran N www.vaneeswaran.com #> $Function_Exit_Status = $false #Variable to store the exit status of the function function Logger ($Log_Message , $Log_File) { try { $log_str = "$(Get-Date -format " yyyy MMM d hh:mm:ss ") $Log_Message " echo $log_str >> $Log_File } catch { write-host “ Caught an exception: ” -ForegroundColor Red write-host “ Exception Type: $ ($_.Exception. GetType ().FullName) ” -ForegroundColor Red write-host “ Exception Message: $ ($_.Exception.Message) ” ...

How to use Unix Commands in Windows

Image
   Do you wanna Enjoy the Comfort of Unix in Windows ?    (without internet)          No need of installing an Unix OS just follow the instruction below Step 1 :Download cygwin installer from internet                          Click here to goto download page Step 2: After Downloading open it Click Install from Internet Choose Direct Connection choose any one of the servers. After that click on Next till you get a window given below                                  Now Choose CUR on your top right and click on Next and proceed.It will take a lot time (Depends upon your connection) Step 3: After Downloading and Installation Completed.Now its time to configure system variables Step 4: Got MyComputer --> C drive --> cygwin --> bin ...