1

Title says it all. Wikipedia says:

Design[edit] PowerShell's developers based the core grammar of the tool on that of POSIX 1003.2.[21]

Windows PowerShell can execute four kinds of named commands:[22]

cmdlets (.NET Framework programs designed to interact with PowerShell) PowerShell scripts (files suffixed by .ps1) PowerShell functions standalone executable programs If a command is a standalone executable program, PowerShell launches it in a separate process; if it is a cmdlet, it executes in the PowerShell process. PowerShell provides an interactive command-line interface, wherein the commands can be entered and their output displayed. The user interface, based on the Win32 console, offers customizable tab completion. PowerShell enables the creation of aliases for cmdlets, which PowerShell textually translates into invocations of the original commands. PowerShell supports both named and positional parameters for commands. In executing a cmdlet, the job of binding the argument value to the parameter is done by PowerShell itself, but for external executables, arguments are parsed by the external executable independently of PowerShell interpretation.[citation needed]

The PowerShell Extended Type System (ETS) is based on the .NET type system, but with extended semantics (for example, propertySets and third-party extensibility). For example, it enables the creation of different views of objects by exposing only a subset of the data fields, properties, and methods, as well as specifying custom formatting and sorting behavior. These views are mapped to the original object using XML-based configuration files.[23]

which indicates that .NET is required and that Linux dotnet is insufficient to run cmdlets.

  • 4
    We would need to know which cmdlets you want to use. The PowerShell that is supported on Linux is limited to a specific subset. Cmdlets that require .NET Framework instead of .NET Core are not functional on Linux. – Ramhound Feb 21 '18 at 20:30
-2

Microsoft recently released PowerShell 6.0 on both Linux and Windows. The two are functionally interchangeable. However, both are a significant departure from PowerShell 5.1 on Windows. Therefore you must develop for v 6 in order to ensure compatibility.

Your package manager will handle Any dependencies.

4

Windows PowerShell vs. PowerShell Core

The following FAQs detail the differences.

PowerShell Core is the successor of Windows PowerShell 5.1 and runs on Windows, Linux and macOS.

...

  1. Will all of my old Windows PowerShell scripts work on PowerShell Core, that is, is PowerShell Core backward compatible with Windows PowerShell?

    Previous PowerShell updates were fully backward compatible. This only applies partly to PowerShell Core. Because PowerShell Core is a cross-platform edition of PowerShell, Microsoft made a few compromises. This means you have to test each and every script to make sure it also works on PowerShell Core.

  2. Will all scripts I write for PowerShell Core run on all supported platforms?

    Basic scripts will run on all platforms. However, considering the huge differences between the supported platforms, you have to test each script on all platforms it is supposed to run on.

  3. Do all modules for Windows PowerShell run on PowerShell Core?

    No, many complex modules have to be adapted for PowerShell Core. In some cases, different module versions exist for both PowerShell editions.

  4. Can I use all .NET Framework classes on PowerShell Core?

    No, PowerShell depends on .NET Core, which lacks many features of the .NET Framework. For instance, Windows Presentation Foundation (WPF), Windows Forms, and Windows Workflow are missing on .NET Core. You can find more information here.

(emphasis mine)

Source Differences between PowerShell versions – 4sysops

  • LOL, "You are not alone. If you find the official PowerShell 6.0 documentation, please add link here" -4sysops. Microsoft. – Thufir Feb 22 '18 at 15:27
2

You can easily determine this for youself, simply by look at them both side by side.

Meaning available module, cmdlets, etc...

PowerShell v6 / Core

https://docs.microsoft.com/en-us/powershell/scripting/powershell-scripting?view=powershell-6

PowerShell v6.0.1
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS D:\> (Get-Command -Module *).Count
425

PS D:\> (Get-Command -Name *).Count
1483



Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\> (Get-Command -Module *).Count
1529

PS C:\> (Get-Command -Name *).Count
2474

So, you literally have "1104" fewer modules and "945" fewer cmdlets at your disposal in PSCore/v6. So, yes, it depends on which you are using and if they are available at all.

Also, to try and get PSCore closer to on par with Windows PowerShell, Microsoft released the PowerShell Compatibility Pack. Yet...

As reported last month the Windows Compatibility Pack for .NET core is available. This adds back some of the functionality missing from .NET core. "This functionality is ONLY of relevance on Windows machines."

https://richardspowershellblog.wordpress.com/2018/01/04/windows-compatibility-pack

1

PowerShell is available for Linux so it would be assumed that the scripts would retain at least most and maybe all their functionality regardless of platform.

  • incorrect assumption, unfortunately. So far as I know, at least. The question being: what's that boundary for "most" and "maybe all"? – Thufir Feb 22 '18 at 15:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.