r/PowerShell • • Mar 04 '20

New PowerShell Version - v7.0.0

https://github.com/PowerShell/PowerShell/releases/tag/v7.0.0
160 Upvotes

70 comments sorted by

View all comments

Show parent comments

39

u/firefox15 Mar 04 '20

Depends what you are comparing it to. Personally, I like the parallel processing ability that has been introduced with ForEach-Object.

19

u/azjunglist05 Mar 04 '20

I feel like that’s the only thing people ever mention about PS 7.0 - is that really the only major change that has been made?

I’ve been using Runspaces for awhile, so it being added to a foreach loop doesn’t really make me gung-ho about it. Genuinely curious though to see from user’s perspectives what has changed!

0

u/[deleted] Mar 04 '20

[deleted]

9

u/BlitzThunderWolf Mar 04 '20

What about active directory stuff on non-windows systems?

5

u/oW_Darkbase Mar 04 '20

I was wondering that aswell, I've heard multiple times that the new PS core versions do not support Active Directory cmdlets and other server administration cmdlets that come with server features / RSAT?

8

u/halbaradkenafin Mar 04 '20

That's worked since 1809 and PS 6.1 on windows.

3

u/Mayki8513 Mar 04 '20

"That's worked since 1809..."

Why was my first reaction "a bit of an exaggeration..." Lol >.<

7

u/Emiroda Mar 04 '20

I've heard multiple times that the new PS core versions do not support Active Directory cmdlets and other server administration cmdlets that come with server features / RSAT?

You've heard lies, or the word of fools. It's worked since 6.1.1 on Windows 10 1809.

https://www.reddit.com/r/PowerShell/comments/f6qef2/psa_activedirectory_module_works_natively_with/

3

u/mryananderson Mar 04 '20

Yes it has I’m wondering about Linux and Mac support. I know that it has to do with some of the .net libraries but wasn’t sure if they are working on it.

0

u/[deleted] Mar 04 '20

[deleted]

2

u/mryananderson Mar 04 '20

Thanks for that! This is literally the only reason right now I run a VM in parallels on my MAC, to run AD commands. I really hope it gets ported because it would make life a lot easier for simple lookups as well as scripts.

4

u/Emiroda Mar 04 '20

They've made them Core-compatible, so in theory they should work on non-Windows systems, but I don't think they've published the module to PowerShell Gallery.

0

u/[deleted] Mar 04 '20

[deleted]

3

u/nick_nick_907 Mar 04 '20

This is the main point, IMO.

6 didn't really replace 5.1 because there were so many Windows Administration modules that weren't supported.

We had a cross-platform tool (Core/6) and a Windows admin tool (WindowsPS/5.1). Now we've got one tool for both.

2

u/rjmholt Mar 04 '20 edited Mar 04 '20

The AD module is still a Windows in-box module. It works with PowerShell 6.1 and up on newer Windows versions (because those versions have the version of the module that works with .NET Core), but Core-compatibility is not automatically cross-compatibility; the module probably has many assumptions about Windows in it still.

Cross-compatibility is a big work item. Taking PowerShell as an example, getting PowerShell to work and be useful on macOS and Linux took much more work than just porting it to .NET Core (although PowerShell started when .NET Core was much more constrained than it is now). Things like the filesystem, user management integration, cryptography libraries, all of that changes when you go between operating systems.

2

u/rjmholt Mar 04 '20

I should also say the AD module isn't part of PowerShell. I think a UserVoice issue like this one is the best place to let the relevant team know what you want.

→ More replies (4)

5

u/azjunglist05 Mar 04 '20

Sweet! Thanks for the breakdown. The chaining and error message output is already sounding pretty worthwhile.

4

u/bozho Mar 04 '20

Is there a good source on PS 7 and Windows-only stuff and DSC?

We use DSC for Window servers' configuration management and a lot of resources depend on .NET Framework stuff. For example, SqlServer module is importable on PS 7. Importing the module in PS 5.1 adds several types used to manage SQL Server components, like [Microsoft.AnalysisServices.Role], but not on PS 7. I assume we'll have to wait and see if underlying assemblies get ported to .NET Core...

→ More replies (1)

3

u/Beirbones Mar 04 '20

What's the chain operator do?

5

u/halbaradkenafin Mar 04 '20

Run the second command only if the first succeeds. I use it a lot in the command line for git commit && git push and similar

→ More replies (1)

2

u/rjmholt Mar 04 '20

There are two of them in fact, the other is ||.

|| will run the second command if the first fails:

icacls .\ex.txt /setowner doesntexist || Write-Error "Did not set file owner"
→ More replies (1)

1

u/segagamer Mar 04 '20

Is there a way to have it replace the Win+X, A/I shortcut?

0

u/[deleted] Mar 04 '20

[deleted]

→ More replies (7)
→ More replies (1)
→ More replies (4)

9

u/ka-splam Mar 04 '20

It's not a huge jump of 6 -> 7, it's more like 6.3 but they want the major version to signal improved compatibility and a long-term-support release. At lot of the work has been improving the auto-loading and module compatibility with PSv5 things so that v7 is not such a breaking change from 5.1.

There are a few differences - some gated features behind experimental enable/disable flags, some operators && and || and & used like Bash does, ?. and ?[] operators to make working with / testing for $null values need less code, ternary operator for shorter if/else test ? code : code; suggesting closely named commands in the case of a command not found, reworking Test-Connection to be more like v5.1 with more useful output, more kinds of numeric literals like 0b0011 for binary number literals, cross-platform get/set-clipboard, add colours and things to Select-String output, add back some cmdlets from PSv5.1 which didn't make it into the new ones such as Get-Hotfix, powershell can now be a login shell on Linux/macOS, better breakpoint display when remoting and debugging, -split can take negative count numbers to split from the right, Export-Csv doesn't need -NoTypeInformation anymore, DSC MOF compilation on non-Windows and use of DSC resources without an LCM, and a bunch of general cmdlet tweaks to parameters and options for convenience and bugfixing.

1

u/DigitalWhitewater Mar 04 '20

That’s definitely handy!