Forum Discussion
Using 'Get-GPInheritance' Command in Powershell 7
mmseng
No it's a bug:
https://github.com/PowerShell/PowerShell/issues/18519
I'm not a habitual PowerShell (as distinct from Windows PowerShell) user, but working with the Get-GPInheritance commandlet in this thread:
- I can replicate the listed issue when using:
Import-Module -Name GroupPolicy;
- The commandlet returns the expected result when having used:
Import-Module -Name GroupPolicy -SkipEditionCheck
It's worth noting that - at least under my now out-of-date PowerShell 7.2.6 - it provides a warning message upon loading this module that it's using the compatibility process described in the documentation:
This may or may not having been around back when this post was created - I have no idea (as I don't use PowerShell.)
I should add that this is assuming you're on Windows (I'm not sure if the GroupPolicy module exists for other platforms), and I fully recognise that testing this one specific scenario is a very long way from being comprehensive.
That disclaimer out of the way, when running the same type check against InheritedGpoLinks (having used -SkipEditionCheck) - in line with the previous posts, it confirms the module is running in-process, meaning serialisation and de-serialisation are no longer an issue.
Cheers,
Lain
- mmsengAug 27, 2023Copper ContributorYes, thanks for this. In my case it was simple enough to use this to work around the issue:
`Import-Module -Name "GroupPolicy" -Force -SkipEditionCheck` - Henrik_Andre_OlsenAug 21, 2023Copper ContributorYes - it's either that, or run your entire PowerShell script in version 5.1 (Windows Powershell).
Thank you for mentioning the PowerShell compatibility mode 🙂