File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ public static bool IsGroupPolicyEnabled()
3333 {
3434 if ( Environment . OSVersion . Platform != PlatformID . Win32NT )
3535 {
36- throw new PlatformNotSupportedException ( "Group policy is only supported on Windows." ) ;
36+ // Always return false for non-Windows platforms and Group Policy is not available.
37+ return false ;
3738 }
3839
3940 if ( InternalHooks . EnableGPRegistryHook )
Original file line number Diff line number Diff line change @@ -8,17 +8,11 @@ Describe 'GroupPolicyEnforcement API Tests' -Tags 'CI' {
88
99 It ' Should return the correct policy enforcement status' - Skip:(-not $IsWindows ) {
1010 $actualStatus = [Microsoft.PowerShell.PSResourceGet.Cmdlets.GroupPolicyRepositoryEnforcement ]::IsGroupPolicyEnabled()
11- $actualStatus | Should - Be $false
11+ $actualStatus | Should - BeFalse
1212 }
1313
1414 It ' Should return platform not supported exception on non-windows platform' - Skip:$IsWindows {
15- try {
16- [Microsoft.PowerShell.PSResourceGet.Cmdlets.GroupPolicyRepositoryEnforcement ]::IsGroupPolicyEnabled()
17- }
18- catch {
19- $_.Exception.Message | Should - Be ' Group Policy is not supported on this platform.'
20- $_.Exception.InnerException.GetType ().FullName | Should - Be ' System.InvalidOperationException'
21- }
15+ [Microsoft.PowerShell.PSResourceGet.Cmdlets.GroupPolicyRepositoryEnforcement ]::IsGroupPolicyEnabled() | Should - BeTrue
2216 }
2317
2418 It ' Group Policy must be enabled before getting allowed repositories' - Skip:(-not $IsWindows ) {
@@ -54,7 +48,7 @@ Describe 'GroupPolicyEnforcement Cmdlet Tests' -Tags 'CI' {
5448 Register-PSResourceRepository - Name ' Example' - Uri ' https://www.example.com/'
5549 $psrep = Get-PSResourceRepository - Name ' Example'
5650 $psrep | Should -Not - BeNullOrEmpty
57- $psrep.IsAllowedByPolicy | Should - Be $true
51+ $psrep.IsAllowedByPolicy | Should - BeTrue
5852 }
5953 finally {
6054 Unregister-PSResourceRepository - Name ' Example'
You can’t perform that action at this time.
0 commit comments