install-script only prompts once ever for environment variable choice
penalvch-zz opened this issue · 1 comments
penalvch-zz commented
Steps to reproduce
See below. As per help docs below, one could pass the -nopathupdate switch to choose no upfront, but there is no opposite, in case one changes their mind later. Instead, one has to manually update PATH:
https://docs.microsoft.com/en-us/powershell/module/powershellget/install-script?view=powershell-7.2
Expected behavior
install-script invoke-process
PATH Environment Variable Change
Your system has not been configured with a default script installation path
yet, which means you can only run a script by specifying the full path to
the script file. This action places the script into the folder 'C:\Program
Files\WindowsPowerShell\Scripts', and adds that folder to your PATH
environment variable. Do you want to add the script installation path
'C:\Program Files\WindowsPowerShell\Scripts' to the PATH environment
variable?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):N
uninstall-script invoke-process
install-script invoke-process
PATH Environment Variable Change
Your system has not been configured with a default script installation path
yet, which means you can only run a script by specifying the full path to
the script file. This action places the script into the folder 'C:\Program
Files\WindowsPowerShell\Scripts', and adds that folder to your PATH
environment variable. Do you want to add the script installation path
'C:\Program Files\WindowsPowerShell\Scripts' to the PATH environment
variable?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):Y
Actual behavior
install-script invoke-process
PATH Environment Variable Change
Your system has not been configured with a default script installation path
yet, which means you can only run a script by specifying the full path to
the script file. This action places the script into the folder 'C:\Program
Files\WindowsPowerShell\Scripts', and adds that folder to your PATH
environment variable. Do you want to add the script installation path
'C:\Program Files\WindowsPowerShell\Scripts' to the PATH environment
variable?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):N
uninstall-script invoke-process
install-script invoke-process
Untrusted repository
You are installing the scripts from an
untrusted repository. If you trust this
repository, change its InstallationPolicy
value by running the Set-PSRepository
cmdlet. Are you sure you want to install
the scripts from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No
[L] No to All[S] Suspend [?] Help
(default is "N"):
Environment data
$PSVersionTable
Name Value
---- -----
PSVersion 7.2.1
PSEdition Core
GitCommitId 7.2.1
OS Microsoft W…
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, …
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Get-Module -ListAvailable PowerShellGet,PackageManagement
Directory: C:\Users\system2\Documents\P
owerShell\Modules
ModuleType Version PreRelease Name
---------- ------- ---------- ----
Script 2.2.5 PowerShel…
Directory: C:\program
files\powershell\7\Modules
ModuleType Version PreRelease Name
---------- ------- ---------- ----
Script 1.4.7 PackageMa…
Script 2.2.5 PowerShel…
Directory: C:\Program
Files\WindowsPowerShell\Modules
ModuleType Version PreRelease Name
---------- ------- ---------- ----
Binary 1.0.0.1 PackageMa…
Script 1.0.0.1 PowerShel…
PS C:\Windows\System32>
Get-PackageProvider -ListAvailable
Name Version DynamicOptions
---- ------- --------------
NuGet 3.0.0.1 Destination, ExcludeVersion, Scope, SkipDepend…
PowerShellGet 2.2.5.0 PackageManagementProvider, Type, Scope, AllowC…
PowerShellGet 1.0.0.1
PS C:\Windows\System32>
StevenBucher98 commented