Invoke-command Access denied on Windows 11 but works with Windows 10

Tyler L. Campbell 0 Reputation points
2024-07-23T15:56:09.5666667+00:00

I'm trying to connect to a remote computer using Invoke-Command while running an elevated Powershell ise. I recently upgraded to Windows 11 and my scripts no longer work and are giving me an Access is denied error. Here is a test script I've been using to try and resolve the issue.

$Creds = Import-CliXml -Path "C:\Install\PowerCreds\Cred.xml" Invoke-Command -ComputerName $Computer -Credential $Creds -ScriptBlock { Test-Path "\network\File\Location"

This is working just fine on my secondary computer with Windows 10. I cloned my Windows 10 computer to a new computer to test Windows 11 in our environment. I've checked all the execution policies and they are set the same as my Windows 10 computer. Trust for Delegation Kerbos Only is turned on for all computers, this was required for Windows 10 to get over the Double-Hop. Does anyone know if there is a setting, registry, or group policy that is new with Windows 11 that needs to be changed?

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,321 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 45,831 Reputation points
    2024-07-23T19:13:10.3833333+00:00

    Did you create a new credential and save it in "C:\Install\PowerCreds\Cred.xml"?

    Credentials are only usable on the machine that creates them, and only by the user that created them.

    0 comments No comments

  2. Tyler L. Campbell 0 Reputation points
    2024-07-24T14:31:25.02+00:00

    Yes they are saved in that location. I got this figured out by using New-PSdrive and passing my credentials that way.

    $Creds = Import-CliXml -Path "C:\Install\PowerCreds\Cred.xml" Invoke-Command -ComputerName $Computer -Credential $Creds -ScriptBlock { New-PSDrive -Credential $Using:Creds -Name Powershell -PSProvider FileSystem -Root "\network\folder" | Out-Null Test-Path "\network\File\Location" Remove-PSDrive -Name Powershell -Force } So adding the New-PSdrive then removing it at the end of the Invoke-Command, still inside it, allowed the credentials to be passed without any problems.

    0 comments No comments