Powershell Kerberos委派问题将文件复制到具有2008 R2域功能级别的远程会话

Powershell Kerberos委派问题将文件复制到具有2008 R2域功能级别的远程会话,powershell,invoke-command,copy-item,Powershell,Invoke Command,Copy Item,当运行下面的代码时,我可以在底部的块中放入任何内容-我正在尝试复制一个文件夹,以便从本地文件夹运行exe,并在远程会话期间将该exe安装到远程计算机。我遇到访问被拒绝的错误。我读到,我不能使用Kerberos委派cmdlet,它只适用于2012及以上的林级别。当前站点具有域功能级别2008 R2。是否有其他方法可以在每个远程会话期间将文件复制到文本文件中指定的计算机上 提前谢谢 $Cred = Get-Credential DOMAIN\USER $Computers = Get-Conte

当运行下面的代码时,我可以在底部的块中放入任何内容-我正在尝试复制一个文件夹,以便从本地文件夹运行exe,并在远程会话期间将该exe安装到远程计算机。我遇到访问被拒绝的错误。我读到,我不能使用Kerberos委派cmdlet,它只适用于2012及以上的林级别。当前站点具有域功能级别2008 R2。是否有其他方法可以在每个远程会话期间将文件复制到文本文件中指定的计算机上

提前谢谢

$Cred = Get-Credential DOMAIN\USER


$Computers = Get-Content C:\tab.txt | Where-Object { $_ } 

ForEach ($Computer in $Computers)
       #  {
       # if (Test-Connection -ComputerName $Computer -BufferSize 16 -Count 1 ` 
       -Quiet) 
        {

        # Creates a new remote PowerShell Session and script block - enter 
        the code you want to execute remotely from this block 

        $Session = New-PSSession $computer -Credential $cred

            Invoke-Command -Session $Session -ScriptBlock {


        Copy-Item -Path "\\print-server\pcclient\win\*" -Destination 
        "c:\pcclient" -Force -Recurse -Verbose
        # Start-Sleep -s 10  
        # Start-Process "\\Print-Server\PCClient\win\client-local-install.exe" -ArgumentList "/SILENT"   

        }

        }

        Remove-PSSession -Session $Session  
########################################


#}

这是因为您在远程计算机上,试图访问另一个网络资源。当您连接到PowerShell中的远程计算机时,您只能有效地连接/验证到该计算机(除非您另有指定),该计算机无权访问您的凭据以访问网络共享,因此到网络共享的连接被视为未经验证,因此会发生故障

本文很好地介绍了这一点,基本上是这样的:您需要在本地运行它(以允许您的计算机传递凭据):

在服务器上运行(以允许服务器接受这些凭据):

并将
New PSSession
命令更新为:

$Session = New-PSSession $computer -Credential $cred -Authentication CredSSP

如果您愿意,您可以使用*.yourdomain.lan或其他任何工具,仅与特定计算机或域的子集共享您的凭据。如果您连接到多台计算机,那么使用
-DelegateComputer*

就更容易了。感谢您提供此信息。我会在接下来的几天里把它浏览一遍。我确实相信credssp包含一些安全缺陷,但是,如果您不介意的话,我会给您一些反馈,再次感谢您的出色响应。
Enable-WSManCredSSP -Role Server –Force
$Session = New-PSSession $computer -Credential $cred -Authentication CredSSP