-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Install-PowerShellRemoting.ps1 fails when run without specifying -PowerShellHome in PowerShell 6.1 GA #7787
Copy link
Copy link
Closed
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.The issue is fixed.
Description
Steps to reproduce
In PowerShell 6.0, Install-PowerShellRemoting.ps1 could be run successfully without any parameters:
PS C:\Program Files\PowerShell\6.0.0> .\Install-PowerShellRemoting.ps1
VERBOSE: Using PowerShell Version: 6.0.0
VERBOSE: Performing the operation "Copy File" on target "Item: C:\Program Files\PowerShell\6.0.0\pwrshplugin.dll Destination: C:\WINDOWS\System32\PowerShell\6.0.0\pwrshplugin.dll".
VERBOSE: Created Plugin Config File: C:\WINDOWS\System32\PowerShell\6.0.0\RemotePowerShellConfig.txt
Get-PSSessionConfiguration powershell.6.0.0
Name : powershell.6.0.0
PSVersion : 6.0
StartupScript :
RunAsUser :
Permission : BUILTIN\Administrators AccessAllowed
Restarting WinRM to ensure that the plugin configuration change takes effect.
This is required for WinRM running on Windows SKUs prior to Windows 10.In PowerShell 6.1 GA, the same command fails:
PS C:\Program Files\PowerShell\6> .\Install-PowerShellRemoting.ps1
& : The term '\pwsh' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\PowerShell\6\Install-PowerShellRemoting.ps1:130 char:30
+ $targetPsVersion = & "$targetPsHome\pwsh" -NoProfile -Command ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\pwsh:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
VERBOSE: PowerShellHome:
VERBOSE: Using PowerShell Version:
Copy-Item : Cannot find path 'C:\pwrshplugin.dll' because it does not exist.
At C:\Program Files\PowerShell\6\Install-PowerShellRemoting.ps1:192 char:5
+ Copy-Item $targetPsHome\pwrshplugin.dll $resolvedPluginAbsolutePa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\pwrshplugin.dll:String) [Copy-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommandHowever, if -PowerShellHome is specified, it works as expected:
PS C:\Program Files\PowerShell\6> .\Install-PowerShellRemoting.ps1 -PowerShellHome $PSHOME
VERBOSE: PowerShellHome: C:\Program Files\PowerShell\6
VERBOSE: Using PowerShell Version: 6.1.0
VERBOSE: Performing the operation "Copy File" on target "Item: C:\Program Files\PowerShell\6\pwrshplugin.dll Destination: C:\WINDOWS\System32\PowerShell\6.1.0\pwrshplugin.dll".
VERBOSE: Created Plugin Config File: C:\WINDOWS\System32\PowerShell\6.1.0\RemotePowerShellConfig.txt
Get-PSSessionConfiguration PowerShell.6.1.0
Name : PowerShell.6.1.0
PSVersion : 6.0
StartupScript :
RunAsUser :
Permission : BUILTIN\Administrators AccessAllowed
VERBOSE: PowerShellHome: C:\Program Files\PowerShell\6
VERBOSE: Using PowerShell Version: 6
VERBOSE: Performing the operation "Copy File" on target "Item: C:\Program Files\PowerShell\6\pwrshplugin.dll Destination: C:\WINDOWS\System32\PowerShell\6\pwrshplugin.dll".
VERBOSE: Created Plugin Config File: C:\WINDOWS\System32\PowerShell\6\RemotePowerShellConfig.txt
Get-PSSessionConfiguration PowerShell.6
Name : PowerShell.6
PSVersion : 6.0
StartupScript :
RunAsUser :
Permission : BUILTIN\Administrators AccessAllowed
Restarting WinRM to ensure that the plugin configuration change takes effect.
This is required for WinRM running on Windows SKUs prior to Windows 10.Expected behavior
PS C:\Program Files\PowerShell\6.0.0> .\Install-PowerShellRemoting.ps1
VERBOSE: Using PowerShell Version: 6.0.0
VERBOSE: Performing the operation "Copy File" on target "Item: C:\Program Files\PowerShell\6.0.0\pwrshplugin.dll Destination: C:\WINDOWS\System32\PowerShell\6.0.0\pwrshplugin.dll".
VERBOSE: Created Plugin Config File: C:\WINDOWS\System32\PowerShell\6.0.0\RemotePowerShellConfig.txt
Get-PSSessionConfiguration powershell.6.0.0
Name : powershell.6.0.0
PSVersion : 6.0
StartupScript :
RunAsUser :
Permission : BUILTIN\Administrators AccessAllowed
Restarting WinRM to ensure that the plugin configuration change takes effect.
This is required for WinRM running on Windows SKUs prior to Windows 10.
Actual behavior
PS C:\Program Files\PowerShell\6> .\Install-PowerShellRemoting.ps1
& : The term '\pwsh' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.0
PSEdition Core
GitCommitId 6.1.0
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.The issue is fixed.