How much can you do with powershell regards system configuration? For example, could you put a Windows Server with PS behind SSH and login and config everything that way without having to touch the GUI?
Yes, this is the preferred approach since Windows 2008 Server Core. Please note that Powershell is only installed by default in Windows 2008 R2 Server Core. You can then use Powershell remoting capabilites, or log into the server with SSH, like on UNIX systems.
PowerShell vs. Unix shells
11–20 of 84 posts
Re: PowerShell vs. Unix shells
#12Earlier quoted context omitted.
Yes, this is the preferred approach since Windows 2008 Server Core. Please note that Powershell is only installed by default in Windows 2008 R2 Server Core. You can then use Powershell remoting capabilites, or log into the server with SSH, like on UNIX systems.
Remoting is a bit hobbled I find. For example I'd love to be able to run vim in a powershell remoting session, but it doesn't seem to work.
Re: PowerShell vs. Unix shells
#13One problem with PowerShell is that it uses too much resources for a shell. I believe it to be superior in some ways to Unix shells, but I was never able to get (psychologically) past the 15 second or more startup time needed on my machine (Windows 7 netbook). Given that languages like Python have less starting times, I am likely to use the command prompt and/or scripting language every time. I guess server people wo…
However in most systems I never had more than 5s startup time.
Re: PowerShell vs. Unix shells
#14The main difference between the two, in my humble opinion, is that PowerShell is a nice (and powerful) addition to a Windows system, whereas the Shell is a fundamental component of Unix. Of course, the two shells may be equivalent in terms of power or number of features, and any contest a la "Can your shell do this?" would be futile. To me, it's a matter of cultural differences. Think of it this way: a shell operates…
I don't know about that. Microsoft operates NuGet (the .NET equivalent of NPM or Gems) and the way of downloading packages is through powershell (albeit a specially docked version inside Visual Studio).
I agree that it's treated as second class in that most utilities are not designed with it in mind first but I can see that changing over time. They are already excellent Powershell equivalents of Make and Apt/Yum by third parties. Third parties have embraced it pretty strongly.
Re: PowerShell vs. Unix shells
#15One problem with PowerShell is that it uses too much resources for a shell. I believe it to be superior in some ways to Unix shells, but I was never able to get (psychologically) past the 15 second or more startup time needed on my machine (Windows 7 netbook). Given that languages like Python have less starting times, I am likely to use the command prompt and/or scripting language every time. I guess server people wo…
As a .NET application Powershell needs to be JITed before execution starts. However in most systems I never had more than 5s startup time.
Re: PowerShell vs. Unix shells
#16- Moving from a text stream manipulation to structure content. No more worrying if separators need to be escaped within the content each time.
- More powerful programming constructs like: Lambda functions, parallel assignments
- Signed scripts
Even though it might not be superior to other shells in every aspect, Powershell's tighter OS integration and OOP approach makes it one of the best shell available on the Windows platform.
Re: PowerShell vs. Unix shells
#17One problem with PowerShell is that it uses too much resources for a shell. I believe it to be superior in some ways to Unix shells, but I was never able to get (psychologically) past the 15 second or more startup time needed on my machine (Windows 7 netbook). Given that languages like Python have less starting times, I am likely to use the command prompt and/or scripting language every time. I guess server people wo…
Re: PowerShell vs. Unix shells
#18One problem with PowerShell is that it uses too much resources for a shell. I believe it to be superior in some ways to Unix shells, but I was never able to get (psychologically) past the 15 second or more startup time needed on my machine (Windows 7 netbook). Given that languages like Python have less starting times, I am likely to use the command prompt and/or scripting language every time. I guess server people wo…
Re: PowerShell vs. Unix shells
#19UNIX shell is not only Bash... Did you guys try fish? I recommend it!
Re: PowerShell vs. Unix shells
#20How much can you do with powershell regards system configuration? For example, could you put a Windows Server with PS behind SSH and login and config everything that way without having to touch the GUI?
The bash way to remotely administer a server is to SSH into the server, then run your commands there. While that's technically possible with PowerShell in recent versions, it's not how PowerShell is designed to work with remote machines. Instead, your local copy of PowerShell is designed to grab the remote server's management objects, and use those to administer the remote server.
For example, say I quickly want to shut down a service on ten boxes. On a Unix system, I'd use a tool like Fabric/Ansible/whatever to quickly SSH into those ten boxes and run "/etc/init.d/whatever stop" (or equivalent). I guess you could do this all on one line with something like
echo box1 box2 box3 ... | tr " " "\n" | xargs -L 1 -I BOX ssh BOX /etc/init.d/whatever stop
but that's really rare, in my experience, compared to using a tool like Fabric.On PowerShell, in contrast, I'd grab the remote service objects, and pipe them into the Stop-Service cmdlet, locally. For example (written verbosely; there's a shorter way to do this):
@('box1', 'box2' ... ) | ForEach-Object { Get-Service -name "whatever" -computername $_ } | Stop-Service
Note what's going on: I'm passing an array of box names in, grabbing out handles to the actual services running on the remote box, and then stopping those, using the local Stop-Service cmdlet.Other things work the same way.
But my favorite part is that Windows servers actually vend a lot of their resources as PowerShell mounts. Changing the configuration of Apache on your server farm? Break out Puppet and some templates on Unix, but on Windows, use the IIS snapin to "cd" right into the IIS configurations on those boxes and use your normal cat/echo magic to change the configurations. Need to change registry settings? You can "cd" into the registries, too. Same for SQL Server. And because this is all through PowerShell, doing things like redirecting a SQL Server database name right into an IIS configuration file (e.g., configuring your website on which DB to use) becomes easy--again, across a pile of machines.
So: yes, you can remote in. But that's not how PowerShell is designed to work, and you're losing a lot of the magic if you do things that way.