WinRM scripting from Linux - linux

How to write a Perl script that runs on Linux and is able to remotely execute a script on a Windows Server via WinRM given the local Administrator credentials?
I'm looking for sample code using a Perl library equivalent to this Ruby library for Windows Remote Management or this Python library for Windows Remote Management.

Have you tried openwsman? It has perl bindings and supports WinRM. Haven't used it myself though.

https://github.com/HugoMaza/WinRM-WinRSExec
It's Perl module that makes you able to remotely execute scripts on a Windows Server via WinRM.

Related

From Linux jenknins call batch command on remote windows server

I have Jenkins installed on Linux environment and would like to call a batch file on windows server. How do I achieve this?
This can be easily achieved w/ https://sourceforge.net/projects/winexe/
Also, there are other options, like using SSH to connect to the windows machine and launch the script.

How to copy files from windows to linux (cross platform)?

I want to trigger command/script from Linux environment which copies file from windows system to my Linux environment.
I have set up local Linux server for my web application. I am using WinSCP for file transfer and Putty as a console.
I want to automate the process of build deployment of Linux server.For that i have to copy build which is on my windows machine and paste it in my local Linux server so that i can deploy it.
As per my understanding, there should be some shared location which is accessible from Linux environment.
Is there is any script available for this? Also, please tell me the configuration changes require to do this.
You can use synchronize command of winscp from your windows,
winscp synchronize command
or winscp.exe command from your command prompt.
winscp.exe command
Install cygwin and you can use scp, ssh etc just like you would on linux. Besides, you can use ordinary bash scripts instead of crappy bat-files.
OR
http://www.codingepiphany.com/2014/01/13/batch-script-for-transferring-files-from-windows-machines-to-linux-file-server/
OR
Use samba
you can use rsync for synchronize your files. http://linux.die.net/man/1/rsync

How can i start some file manager in Powershell under SSH?

I have downloaded Windows PowerShell SSH Server from Here. So, now i can ssh from Linux to Windows, and get to PowerShell.
But if i use another way, connect from Windows to Linux via SSH, i can run something like Midnight Commander or other File Manager. How can i run some File Manager under PowerShell under SSH from Linux?
I tried to run Far Manager, but not succeeded.
I don't believe such an interactive application is possible to be programmed in command prompt or PowerShell. So there is no way to do this even within PowerShell, let alone connect to PowerShell from a Linux system via SSH.
As pointed out by Ansgar Wiechers in the comment below, there are some File managers that run locally in a command prompt or PowerShell, but not in an SSH session.

SSH connection with NAnt script

Is there a way to make an ssh connection from a windows command line to a Linux machine not using putty?
The Idea is to be able to use NAnt to issue linux commands on the target Linux machine.
Yes. The Cygwin ssh client works from the Windows command line.
If you're looking to avoid any 3rd party tool besides nant, then no.

Simple protocol for remote process startup/shutdown

I'm looking for a simple protocol to control remote processes from one managing application. The remote processes will run on Windows and Linux (x86).
Is there a simple protocol for managing remote processes, for which I could find daemons that run on both Windows and Linux?
I consider ssh to be the "Swiss-army knife" of remote administration. A custom script communicating over ssh can then do the process management. On Windows, I install ssh as part of Cygwin.
On windows you can use shutdown.exe \\remote_name [/y] [/c]
http://support.microsoft.com/kb/317371
Thanks Nathan.
Windows users can also use the following package instead of Cygwin: http://sshwindows.sourceforge.net/

Resources