Solved

How to connect to  different servers and run local scripts?

Posted on 2011-02-25
3
988 Views
Last Modified: 2012-05-11
Experts,

       I need to create a Powershell script that will go out and SSH from the PDC. The SSH needs to reach WIndows machines, thin clients, VSM, RHEL5. Once the connection is made I need a local script run. I wrote a psuedocode of what I'm looking for..
I have putty on Windows server. So I can take advantage of plink etc.
Thanks, Missymadi
# If servers are Windows

If $Computer = “Windows” do the following

$ArrComputers = "Computer1", "Computer2", "Computer3" 
foreach ($Computer in $ArrComputers) 
{ write-host "
" write-host "====================================" 
write-host 
"Computer: $Computer" 
write-host "====================================" write-host "-----------------------------------"
 write-host "Win32_PnPEntity instance"
 write-host "-----------------------------------" 

Run a Windows Powershell script
Exit
} 

#If servers are RHEL5 Servers

If $Computer = “RHEL5” do the following

plink root@Linuxbox -m local_script.sh

#if servers are VM host 

Connect-viserver –server <server> -user <user> -password<pwd>
(use the Connect-VIServer cmdlet and provide a value to the server parameter

Open in new window

0
Comment
Question by:missymadi
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
lanboyo earned 500 total points
ID: 34985095
I have not verified this but...

http://huddledmasses.org/scriptable-ssh-from-powershell/

using the ssh-keygen app from putty you can also enable the servers for passwordless login...
0
 

Author Comment

by:missymadi
ID: 34991947
I want to try this in our lab. Do I need the latest copy of Powershell for this to work?

Do you have an example of a Powershell script that would connect from a Win2k3 to a Linux machine and run a script?

I'm also looking for guidance for creating a Powershell script like I discribed above. I need one script and based on the computer name, and if it is pingable then connect to the remote computer and run a local script.
Thanks, Missymadi
0
 

Author Closing Comment

by:missymadi
ID: 35235755
Did not respond
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now