Solved

How to connect to  different servers and run local scripts?

Posted on 2011-02-25
3
993 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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