missymadi
asked on
How to connect to different servers and run local scripts?
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Did not respond
ASKER
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