如何使用PowerShell和robocopy将文件备份到服务器? [英] How to use PowerShell and robocopy to backup files to a server?

查看:412
本文介绍了如何使用PowerShell和robocopy将文件备份到服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是从PowerShell开始,所以请保持友善.

I am just starting with PowerShell, so please be kind.

我要做的就是使用PowerShell和robocopy将我的笔记本电脑中的目录和文件备份到台式机(即服务器").我是两台计算机的管理员(Windows 7).

All I want to do is backup my directories and files from my laptop to the desktop computer, i.e. "server", using PowerShell and robocopy. I am the administrator to both machines (Windows 7).

此操作失败,尽管在服务器"(即桌面)上进行了 访问被拒绝 ,尽管已为每个人"设置了权限以执行所有操作.

This fails with access denied on the "server", i.e., desktop, despite the permissions being set for "Everybody" to do everything.

我们非常感谢您提供的任何帮助(或更好的方法)!谢谢.

Any help (or better way) is really appreciated! Thanks.

$cred=get-credential

$sourcepath = ("\\localhost\C$\nova5");
$TargetPath = ("\\library\E$\nova5");


New-PSDrive -Name source -PSProvider FileSystem -Root $SourcePath 
New-PSDrive -Name target -PSProvider FileSystem -Root $TargetPath -Credential $cred

robocopy source target /e;

return;

推荐答案

Psdrive是Powershell cmdlet的一项功能,不适用于外部命令,请更改此行:

Psdrive is a feature for powershell cmdlet not for extrrnal command , change this line:

robocopy "\\localhost\C$\nova5" "$TargetPath" /e

这篇关于如何使用PowerShell和robocopy将文件备份到服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆