File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,27 @@ BeforeDiscovery {
66 $identity = [System.Security.Principal.WindowsIdentity ]::GetCurrent()
77 $principal = [System.Security.Principal.WindowsPrincipal ]::new($identity )
88 $isElevated = $principal.IsInRole ([System.Security.Principal.WindowsBuiltInRole ]::Administrator)
9+
10+ if ($env: GITHUB_ACTION ) {
11+ Write-Verbose - Message " Running in GitHub Actions" - Verbose
12+ # Uninstall the PSDesiredStateConfiguration module as this requires v1.1 and the build script installs it
13+ Uninstall-PSResource - Name ' PSDesiredStateConfiguration' - Version 2.0 .7 - ErrorAction Stop
14+ # Get current PSModulePath and exclude PowerShell 7 paths
15+ $currentPaths = $env: PSModulePath -split ' ;' | Where-Object {
16+ $_ -notmatch ' PowerShell[\\/]7' -and
17+ $_ -notmatch ' Program Files[\\/]PowerShell[\\/]' -and
18+ $_ -notmatch ' Documents[\\/]PowerShell[\\/]'
19+ }
20+
21+ # Check if Windows PowerShell modules path exists
22+ $windowsPSPath = " $env: SystemRoot \System32\WindowsPowerShell\v1.0\Modules"
23+ if ($windowsPSPath -notin $currentPaths ) {
24+ $currentPaths += $windowsPSPath
25+ }
26+
27+ # Update PSModulePath
28+ $env: PSModulePath = $currentPaths -join ' ;'
29+ }
930 }
1031}
1132
You can’t perform that action at this time.
0 commit comments