I have various .vbs script that executes smoothly using SecureCRT but I would like to execute them using putty.
From your description it looks like SecureCRT can run vba scripts directly somehow (it probably has some API for that). PuTTY cannot do that.
Related
I have a case where my users runs a script (bat) file that I wrote on win7 as admin. Im looking for a simple way (without installing any tools) to make a different script that I wrote run on windows start up through this batch file.
I tried using startup folder but that will run my script without admin rights. I also read about a solution with runas command but it didnt work and also its problematic to know the user details in advanced. I looked online but couldnt find anything to help me to do this automatically through the command line
UPDATE
By looking at the answers im thinking maybe the situation is not clear enough.
Im writing this script on my pc. I give this script (batch file) to my clients, who lack any knowledge of how to do anything but simple stuffs, such as openning cmd as admin and running my batch file that I write in advance. To sum up, I need this batch to be able to set a process (a different batch or vbs file) to run with admin privelleges on startup of the pc (again, without requiring my clients to do any complicated actions, im hoping to get my script to do everything for them)
If you do not have the credentials for the administrator account, you will not be able to run the script with elevated privilege. If you do have those credentials, then you can set up a scheduled task (described at this SevenForums post), running it under the administrator account.
Check the script carefully, and ensure that it's not incorporating anything that may cause problems, like an unavoidable GUI presentation - this question on ServerFault discusses that pitfall.
Make a shortcut to your batch, set its properties>advanced to run as administrator and then move the shortcut to the startup directory.
I work for a application dev company but I am in the support side of it. I am looking to run scripts on to remote-host (logmein Rescue Technician Pro). Our clients all run windows machines and the oldest OS version we support is XP SP3 and the latest win8. I need a scripting language that is native to windows and doesn't require any download this or unzip that. These scripts are Powershell scripts but as we all know the executionpolicy needs to be set to unrestricted. I need a scripting language that automates mouse clicks and keystrokes like hitting enter on the keyboard or typing words into cmd/Powershell, then hitting enter for example. I am trying to run a script in another language to disable the excutionpolicy in Powershell and then start the powershell scripts from this point. I hope I have explained myself.
UPDATE:
I am bad at what I am trying to explain I guess. I need to run a script to disable ExecutionPolicy on remote users through LOGMEIN RESCUE TECHNICIAN. Logmein has a tab called "SCRIPTS" that automatically startup when you connect to the remote session. The problem is that PowerShell by default is set to executionpolicy restricted. That will not allow my scripts to run and I have to run them manually from my machine, I believe their is a way to just run the scripts and have them out put the results to me without having to pull up the remote users GUI, all the computers are their own independent machines and not on a domain. I need to run the scripts as unrestricted on the remote machine on initiation of the remote session. Thats why I having going around in circles trying to figure this out. I was able to disable powershell from the cmd but i need to hit enter, i need to script the enter key stroke but again i keep running into blocks just run my scripts. I'm annoyed by this now at this point.
You can run a powershell script like so:
powershell -executionpolicy unrestricted -file "C:\Myscript.ps1"
This will not change the global executionpolicy for the whole machine, but just to run that script.
Two options:
1.Stick with PowerShell. When you launch PowerShell, instead of launching from the shortcut, run the following command (either from a cmd prompt, or run command):
powershell.exe -ExecutionPolicy ByPass
This will run PowerShell with the execution mode set to ByPass.
2.Use the old way of scripting that works on all versions of Windows, VB scripts. (although, after using PowerShell, VB scripts are hard to go back to)
I'd honestly go with JScript (or VBScript, but JScript is a much nicer language IMHO), since you don't want to have to install anything on the remote machines. XP doesn't include PowerShell, so you'd have to install it at some point.
WSH (Windows Scripting Host) languages like VBScript and JScript, and PowerShell can all simulate mouse clicks and keystrokes, but if you want one script that will run on all of those platforms out-of-the-box, you'll need to stick with WSH languages.
If you have any control over what gets installed on the remote systems, though, go with PowerShell, or - at very least - make sure that the Windows Scripting Host components are up to date with the latest release available for the platform. I'm not sure whether that would come as part of the typical Windows Updates or not.
Just my $0.02.
I am trying to work on a old script of mine that I was writing to backup file on my VMware server.
Originally the script was going to run on Linux only, but now I trying to figure out how to make it run on Windows. Most of the modules I need for perl will run on Windows and Linux which is good. But there is one module that I can't seem to find, which is an SSH module.
My plan was to use putty or plink to send commands to the server and return them to the script. But the problem that I see is every time I call putty in the script its going to open new connection to server and close it when it has finished. What I am looking for is a way to open a connection once its open leave it open and then send and receive from that one connection. Only having it close when the script calls a close function or something.
Any idea where I could being with something like this?
Unless someone else has a much better idea because I am open to anything.
There's quite a few SSH client modules from CPAN, such as Net::SSH, Net::SSH::Perl, and Net::SSH2.
You can also try using Expect
http://metacpan.org/pod/Expect
So I want to open my workspace automatically when I open a profile for work, the problem is that it opens the windows (and windows splits) correctly but doesn't run any script to start my server, celery tasks, get into the correct folders, etc.
Is there a way to do this? even running a bash script would work for me, it doesn't have to be supported by iTerm.
I think you will find this article useful. It uses Apple Script to tell iTerm2 to open multiple windows and run commands in each of them.
http://90kts.com/2011/09/29/split-panes-and-remembered-sessions-in-iterm2/
I have an application running only on Windows and a batch file that launches it.
I want to invoke this batch file from Linux, meaning something like Linux batch will launch the windows batch with parameters and this in its turn run my application.
Can I do that? How?
You could install an ssh server in the windows box (Cygwin has one), then from linux do something like:
ssh user#windows-box c:/path/to/batch.cmd
and that should launch your application in the windows box.
The most direct way is probably to install an ssh server on the windows box. Cygwin includes an ssh server.
Depending on how precise your timing needs are, you might be able to have an "at" job on the windows box that runs periodically (every 5 minutes?) and runs if it sees that a particular file exists, deleting the file. Then you could use Samba/smbclient to create the file. You would need to turn on filesharing on the windows box for this to work.
If the windows box has a web server, you could write a CGI, and trigger it using wget or cURL.
Our build process currently goes the other way: a windows sever kicks off things on the Linux server using plink (part of PuTTY). You might be able to set something similar up.
This may cause a security issue. Our information security person did not allow me to invoke any programs directly.
The safer way is to set up server on Windows computer. This can be a web-server for example. And then invoke your process inside PHP/Perl/Python script.
Also look at winexe that allows you to execute windows commands/batch scripts without running ssh server.