Repository navigation
Closed
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe 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.0Metadata
Metadata
Assignees
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.
Activity
iSazonov commentedon Sep 17, 2018
Seem
$PowerShellHomeis assigned in global in your session.janegilring commentedon Sep 21, 2018
From a fresh pwsh 6.1 session:
PS C:> $PowerShellHome
PS C:> $PSHome
C:\Program Files\PowerShell\6
PS C:>
MaximoTrinidad commentedon Sep 21, 2018
Just wondering... Is this script still needed?? Or, is this scripts runs during the PowerShell Core installation when you checked on the "Enable remoting" option?
Just want to be clear on it!
Thanks
:)
Orca88 commentedon Sep 12, 2019
There is a simple fix to this issue, replace
if ($PowerShellHome -ne $null)with
if (-not [String]::IsNullOrEmpty($PowerShellHome))and the script will work without specifying -PowerShellHome.
iSazonov commentedon Sep 13, 2019
Orca88 Could you pull PR with the fix?
/cc Travis Plunk (@TravisEz13)