我正在尝试使用roboCopy命令访问存储在远程计算机上的文件。我具有对该目录的完全访问权限,并且可以手动访问这些目录,但是使用robocopy时,我遇到访问被拒绝的错误,请参见下面的错误。
[exec] INFO: Creating PSSession on didnaruina6.apac.sas.com
[exec] Access is denied
[exec] + CategoryInfo : PermissionDenied: (\\didnacj01ina6...10014\LAXAG-2.8:String) [Test-Path], UnauthWARNING: Caught Exception Exit 1
[exec] orizedAc
[exec] cessException
[exec] + FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.TestPathCommand
[exec] + PSComputerName : didnaruina6.apac.sas.com
[exec]
[exec] ERROR: Source \\didnacj01ina6.apac.sas.com\Sandbox\SQLDB\010014\LAXAG-2.8 does not Exist
[exec] At C:\Tetris\modules\G3\Scripts\Invoke-G3RoboCopy-SandBox.ps1:52 char:3
[exec] + Invoke-Command -Session $Session -ScriptBlock {
[exec] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[exec] + CategoryInfo : OperationStopped: (ERROR: Source \... does not Exist:String) [], RuntimeException
[exec] + FullyQualifiedErrorId : ERROR: Source \\didnacj01ina6.apac.sas.com\Sandbox\SQLDB\010014\LAXAG-2.8 does not Exist
[exec]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
下面是调用roboCopy时执行的代码。
Invoke-Command -Session $Session -ScriptBlock {
Param([string]$VerbosePreference,$Server,$Source,$Destination,$Params)
If(!(Test-Path $Source)) {throw "ERROR: Source $Source does not Exist"}
Write-Host "INFO: Starting RoboCopy Archana...."
$RoboCommand = "Robocopy `"$Source`" `"$Destination`" $Params /NC /NFL /NS /NDL /NP"
Write-Verbose "Executing [$RoboCommand]"
Invoke-Expression -Command $RoboCommand
$RoboCopyExitCode = $LASTEXITCODE
If ($RoboCopyExitCode -gt 7 -and $RoboCopyExitCode -ne 9 -and $RoboCopyExitCode -ne 11){
Throw "ERROR: RoboCopy Exit Code $RoboCopyExitCode"
}
} -ArgumentList $VerbosePreference,$Server,$Source,$Destination,$Params
我们不能使用roboCopy将数据从远程计算机复制到本地计算机吗?我们是否需要赋予一些特殊权限才能使之成为可能?