File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
setup-powershellget/Setup Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,25 @@ Param(
17
17
[switch ]$Install
18
18
)
19
19
20
+ function EnsureRegistryPath
21
+ {
22
+ $originalpaths = (Get-ItemProperty - Path ' Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' - Name PSModulePath).PSModulePath
23
+ if ($originalpaths.Contains (" $env: ProgramFiles \WindowsPowerShell\Modules" ) -eq $false )
24
+ {
25
+ Write-Output " Fixing PSModulePath"
26
+ $newPath = " $originalpaths ;$env: ProgramFiles \WindowsPowerShell\Modules"
27
+ Set-ItemProperty - Path ' Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' - Name PSModulePath –Value $newPath
28
+ }
29
+ else
30
+ {
31
+ Write-Output " PSModulePath successfuly validated"
32
+ }
33
+ }
34
+
20
35
$error.clear ()
21
36
try {
22
37
if ($Install.IsPresent ) {
38
+ EnsureRegistryPath
23
39
Write-Output @"
24
40
25
41
Finalizing installation of Azure PowerShell.
@@ -57,4 +73,5 @@ Write-Output "An error occured during installation."
57
73
Write-Output $error
58
74
Write-Output " Press any key..."
59
75
$host.UI.RawUI.ReadKey (" NoEcho,IncludeKeyDown" )
60
- }
76
+ }
77
+
You can’t perform that action at this time.
0 commit comments