Does PowerShell work on operating systems other than Windows?
Yes.
Much of PowerShell is .NET, so it can run on any operating system that has the Common Language Runtime (CLR). On Windows, that's the .NET Framework. For other operating systems (including Linux!), you can use the CoreCLR, an open-source, cross-platform subset of the .NET Framework.
As you found in the PowerShell repository on GitHub, quite a few OSes and distributions are supported. For example, here are the instructions for Ubuntu. Demonstration (source page):
One could argue that not all of PowerShell is available in non-Windows environments. Some features depend on libraries only found on Windows. The ParsedHtml
property on the HtmlWebResponseObject
type returned by Invoke-WebRequest
, for example, is only useful on Windows because it holds a COM object that comes from an unmanaged library, mshtml.dll
to be specific. On other platforms, there's nothing there. And, of course, there are cmdlets to manage systems only found on Windows, like Modern apps (Get-AppxPackage
and friends).
Still, though, the PowerShell infrastructure works perfectly fine on other operating systems. Plenty of cmdlets are usable anywhere, and support is only getting better.
The latest powershell for macos (6 alpha) has better .net support. But it only works in Sierra osx. For example, this works now where before it didn't:
$ping = New-Object System.Net.Networkinformation.ping
$ping.Send('yahoo.com', 500) # timeout 500 ms
[Net.DNS]::GetHostEntry('yahoo.com')
The default console colors are terrible though (yellow for commands, etc).
set-psreadlineoption command darkyellow