Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can WFA workflows execute unix scripts on a unix server . If it can execute script do you have a working example
10 REPLIES 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Aneesh,
You can definitely execute a unix script/command remotely and capture the output.
I do not have an example script or the exact way of doing it but here is what you can try:
I am assuming you have the script on the WFA machine.
Create a new command that makes use of the tool 'plink' to connect to a remote machine. Something like this:
$cmd = `C:\plink.exe -ssh -m C:\checkspace.sh name@ip -pw password ` > C:\output.txt
source:https://groups.google.com/forum/#!topic/microsoft.public.windows.powershell/sDJZtr9qUfk
I haven't checked the correctness of the command yet. For the powershell syntax, you can check other commands.
In case you need help with creating the command, let me know.
I suggest you first try the command from the PS CLI.
I will try to explore for a better answer for you.
-Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI Aneesh,
You should also be able to create a command that performs SSH directly to the UNIX box. You can use PowerShell or Perl to make the connection.
Regards,
- Rick -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aneesh,
WFA can do anything that a powershell and .NET can do and a powershell can do (almost) anything. You don't need any external tools or APIs. You can use Invoke-NaSsh cmdlet to get this done.
Attaching the .dar file which is a WFA command to do it. This .dar can be imported on WFA2.0.1 or above.
Command Code:
=================
param (
[parameter(Mandatory=$true, HelpMessage="Unix Command or Script Path")]
[string]$Script,
[parameter(Mandatory=$true, HelpMessage="Unix Host Name")]
[string]$UnixHost
)
try {
$creds = Get-NaCredentials -Host $UnixHost
}
catch {
$creds = Get-WfaCredentials -Host $UnixHost
}
$returnData= Invoke-NaSsh -Name $UnixHost -Credential $creds -Command $Script
Get-WFALogger -Info -Message $returnData
======================
sinhaa
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do i need to create a passwordless ssh between the WFA server host ( windows server ) and the target unix server to exeute this workflow . How can the workflow get the target unix host credentials .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No Aneesh. This doesn't require passwordless login. You can set the credentials of your Unix Host at tab "Execution" => "Credentials" . If you read the description of this command, it tell you where to save the credentials.
1. Add Credentials
2. Match: Exact
3. Type: Other
4. Give username and password.
5. Save it.
See the image below.
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May I use this procedure to execute a remote script in Windows too ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, only you need to have SSH server ( e.g. Openssh or FreeSSHD etc.) running on your windows host.
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there any example workflow for calling unix script from WFA ? If means can any one share ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've already attached the .dar file for the command and also the command code along with the instructions how to use it. You need anything else?
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i need an example workflow to call the script from the unix server.