powershell上传文件到服务器,Powershell:powershell脚本同步备份文件到其他服务器

2023-05-16

Remove-PSDrive Z

$User = "192.168.1.1\administrator"

$PassWord = ConvertTo-SecureString -String "Passw@rd" -AsPlainText -Force

$Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PassWord

New-PSDrive -Name Z -PSProvider FileSystem -Root \192.168.1.1\Backup -Persist -Credential $Credential

$timelabe = Get-Date -UFormat "%Y-%m-%d-%H-%M"

Get-date -uformat "%c" >> d:\log\$timelabe.log

echo "Starting synchronize files..." >> d:\log\$timelabe.log

robocopy D:\Backup Z:\ /mir >> d:\log\$timelabe.log

Get-date >> d:\log\$timelabe.log

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

powershell上传文件到服务器,Powershell:powershell脚本同步备份文件到其他服务器 的相关文章

随机推荐