[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to connect to  different servers and run local scripts?

Posted on 2011-02-25
3
Medium Priority
?
998 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 1500 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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 …
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
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…

650 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