Custom Search
Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Tuesday, October 29, 2013

How to directly SSH to Windows Command prompt or Powershell prompt from remote Linux Machine

1)
Goto Windows System and Open freesshd and goto "SSH" tab and set "Command Shell" to C:\WINDOWS\system32\cmd.exe  to SSH to Command prompt from remote Linux Machine

2)Open freesshd and goto "SSH" tab and set "Command Shell" to C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe  to SSH to Powershell prompt from remote Linux Machine

Thursday, October 24, 2013

How to execute powershell command remotely from linux using Python

1)
Install freeSSHd on your Windows System
http://fosshelp.blogspot.in/2013/10/how-to-ssh-to-windows-from-linux-using.html

2)
Execute following Python script From Your Linux System
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print "\nConnecting"
ssh.connect('192.168.1.7', username='saju', password='saju')
print "\nConnected"
##Supported -OutputFormat Text, XML, none
cmd = "powershell -InputFormat none -OutputFormat TEXT Get-VMHost"
stdin, stdout, stderr = ssh.exec_command(cmd)
print stdout.readlines()



3)
Text Output


4)
XML OUTPUT


5)
Output from Powershell



How to SSH to Windows Machine from Linux Machine using freeSSHd