0
New-PSDrive
を使用してリモートサーバーに接続する際に問題が発生しています。リモートサーバーはWindowsベースであり、書き込めるのはuserA
のみです。New-PSDrive:ネットワークパスが見つかりません
次のコードは、エラーを「アクセス拒否」スロー、と言って:
Access to the path '$remoteServerPath' is denied on line3
コード:
New-PSDrive -Name remote -Root $remoteServerPath -PSProvider FileSystem
$destination = [IO.Path]::Combine('remote:', $fileName)
Copy-Item -Path $source -Destination $destination -Force
は今、私は資格情報を含むようにしようとしていますが、私は別の取得エラー!
The network path was not found on line3
$secpass = ConvertTo-SecureString 'myPassword' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ('domain\userA', $secpass)
New-PSDrive -Name remote -Root $remoteServerPath-PSProvider FileSystem -Credential $cred
$destination = [IO.Path]::Combine('remote:', $fileName)
Copy-Item -Path $source -Destination $destination -Force
誰も私を助けてくださいことはできますか? Powershell Ver。 5
私は、次のエラーを取得しています: 「FileSystemプロバイダーのみ新-PSDriveコマンドレットの資格情報をサポートしています 指定した資格情報なしで操作を再実行してください。」そのまま、この例を使用して@Adrian – Adrian
? – TheIncorrigible1
New-PSDriveのみが資格情報をサポートしているようですが、copy-itemはサポートしていません。それは私のPS版のためですか? (5) – Adrian