1

Been able to do it against Microsoft.PowerShell (5.1), but today I hit a known issue on 5.1 with remote Copy-Item so I installed PowerShell 7 on the remote server (checking "Enable Remoting" in the installer) and am trying to get it working.

    $securePassword = ConvertTo-SecureString -AsPlainText -Force -String $Password
    $credential = New-Object -TypeName system.management.automation.pscredential -ArgumentList $Username, $securePassword
    $session = New-PSSession $targetMachineHostName -Credential $credential -ConfigurationName "Microsoft.PowerShell"
    Enter-PSSession $session

Above works. But if I change ConfigurationName to "PowerShell.7.1.0" I get:

[myserver.com.au] Connecting to remote server myserver.com.au failed with
     | the following error message : <f:WSManFault
     | xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2689860592"
     | Machine="myserver.com.au"><f:Message><f:ProviderFault provider="PowerShell.7.1.0"
     | path="C:\Windows\system32\PowerShell\7.1.0\pwrshplugin.dll"></f:ProviderFault></f:Message></f:WSManFault> For more information, see the about_Remote_Troubleshooting Help topic.

On the remote server I've run enable ps remoting in a 7.1 powershell so if I run Get-PSSessionConfiguration it returns a bunch of configurations, including the following:

Name          : PowerShell.7.1.0
PSVersion     : 7.1
StartupScript :
RunAsUser     :
Permission    : NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed, BUILTIN\Remote
                Management Users AccessAllowed

The dll the error refers to exists on the machine.

The user credentials I'm using are for a Local User on the remote machine that isn't an Administrator, but belongs to the Remote Management Users group.

Also worth noting from the remote machine itself (as a different Adminstrator local account, I can start a session to localhost).

benmccallum
  • 1,241
  • 12
  • 27

2 Answers2

1

After making the user an Administrator I was able to connect, but I'd gone to great lengths earlier to make non-Adminstrator possible on 5.1.

Out of interest, I tried giving the user Full Control to C:\Windows\system32\PowerShell\7.1.0 and then I could connect...

Still would love to know what's going on though and whether I'm doing the right thing or minimum permissions required.

It seems like the minimum security permissions to the folder are:

  • Read & Execute
  • List folder contents
  • Read
  • Write

Write is bizarre, but without it I get that error. I've assigned those permissions to the "Remote Management Users" group.

Docs here touch a little bit on v5.1 vs v7, and then link to here mentioning an install script so maybe something has fallen through the cracks.

benmccallum
  • 1,241
  • 12
  • 27
0

I was getting the same error. I installed PowerShell 7 from Microsoft Store and then ran Enable-PSRemoting. I got this error so I uninstalled it and reinstalled it from WinGet which uses the MSI. That didn't work either. I tried running Enable-PSRemoting again, but nothing changed.

I ran Install-PowerShellRemoting.ps1 and it gave me two errors about things already existing and did not fix the problem. However, I was able to resolve the problem by doing the following:

  1. Delete the PowerShell 7 plugins: Remove-Item 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Plugin\PowerShell.7','HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Plugin\PowerShell.7.1.1'.
  2. Run Install-PowerShellRemoting.ps1 again.

I'm not sure what the difference was, but deleting and allowing the script to generate it again fixed it for me.

mdonoughe
  • 515
  • 5
  • 12