This topic contains 8 replies, has 4 voices, and was last updated by
September 20, 2013 at 6:33 am #10283
I have to run some powershell scripts from Linux hosts. What is the best recommended way to achieve this? I noticed on a powershell video, Jeffrey Snover from Microsoft executing powershell scripts from linux which kind of blowed me and now I need to know how to do this? Some people says hosting some web page in IIS and then execute, but I wonder if there is a recommended way?
P.S. I am almost new to powershell, my bash and python script skills are way better. But I really liked the powershell features and impressed and the primary reason I am very interested in powershell to manage vmware infrastructure via powercli.
September 20, 2013 at 6:37 am #10284
I did look at installing ssh server on windows, but most of the good ones requires buying a commercial ssh server for windows. But like to know if there is any other solution other than hosting something in iis or ssh server for windows.
September 20, 2013 at 6:38 am #10286ParticipantTopics: 0Replies: 669Points: 0Rank: Member
You could set up a Windows 2012 server and use PowerShell Web Access
I presented on this at the Powershell Summit this year
If you look carefully you will see me using a Linux client machine to run PowerShell in a browser through the Windows 2012 PowerShell Web Access site
September 20, 2013 at 6:42 am #10287KeymasterTopics: 13Replies: 4872Points: 1,811Rank: Community Hero
(You may not have seen Snover actually executing PowerShell scripts from Linux – he modifies his PowerShell prompt to make it look like a Bash prompt, but it's still PowerShell and it's still running on Windows.)
PowerShell itself doesn't natively use SSH. It uses something called Remoting, which uses the WS-Management protocol. If you have a Linux WS-Management client, then you can use it a lot like SSH to connect to a remote PowerShell instance running on Windows, and ask that copy of PowerShell to run commands. I'm not aware of any Linux WS-Management clients, but the protocol specification is published and it's something that, in theory, someone could write.
In the meantime, PowerShell Web Access (PWA) is probably the way to go. As Richard notes, it's available on Win2012 and later and does require IIS. You only need it on one "gateway" computer: You connect (via Web browser) to the PWA server, and it connects to whatever PowerShell-enabled machine you want to manage. It acts as a middleman to create an HTML PowerShell interface between you and the machine you're managing.
September 20, 2013 at 6:57 am #10288
Thanks all. Makes sense. Appreciate the quick response.
September 23, 2013 at 4:09 pm #10326ParticipantTopics: 4Replies: 16Points: 0Rank: Member
Just a quick note. PowerShell Web Access is cool in theory and practical in a pinch.
That being said, I would not recommend using it as a shell even to my enemies. It is quite limited and clunky. If you want to use PowerShell, use a Windows system.
You mentioned running scripts. PSWA means you connect and run things manually . A Scheduled Task, or some other means of running your PowerShell script would be a better bet if you don't plan to run it manually.
September 24, 2013 at 12:56 pm #10346
Yes, could be nice if Microsoft shipped windows with SSH server (similar to what it has done with NFS support) and that could make things a lot more easier. Unfortunately I have to manage a mixed environment where i Have linux, freebsd and Windows. So SSH server could help. Yeah after looking a lot it does look like it requires some monkeying to call powershell scripts from linux servers.
Such a good tool but less interoperable with other systems. SSH built in support in windows could be so nice and could actually make windows more popular on the server side.
Again, no complain with powershell as I do think powershell was developed very good and actually better than bash where I do manipulate a lot of strings etc to get things working.
My last option is to buy a 3rd party ssh server.
September 25, 2013 at 12:55 am #10350ParticipantTopics: 0Replies: 669Points: 0Rank: Member
Look at what's available from /n software – they do a SSH server if I remember correctly
September 30, 2013 at 6:38 pm #10442
After some head scratching and research, I ended up overcoming this challenge through free open source product saltstack which I use for my other production multiple server management and orchestration purposes. With saltstack, you can configure a Windows system as a salt-minion (like a client or managed server) and then executing remote commands and perform various operations from Linux server. I also made a youtube video demonstrating executing a powershell script on a Windows 2012 R2 preview from a centos VM. Once I figured out it took me 15 minutes to try it our and prove out the theory.
Checkout this video and let me know if you have any thoughts:
The topic ‘Executing Powershell Scripts from Linux Servers’ is closed to new replies.