powershell 备份还原outlook邮件签名 1


背景:

近期公司电脑都在升级win10,每次配置邮箱都需要多次操作,后来发现前面的备份文件路径,写了个脚本进行备份和还原

C:\Users\sunzt\AppData\Roaming\Microsoft\Signatures

$temp="\\nd-andon-client\TEMP\Signatures" #备份存放的路劲
if(!(Test-Path $temp)){
    New-Item -path (Split-Path $temp) -Name "Signatures" -type Directory
}
$usertemp="$temp"+"\$env:USERNAME"      #签名文件的存放路径
$usertemp
if(!(Test-Path $usertemp)){
    new-item -path "$temp" -name $env:USERNAME -type directory 
    $path=$env:APPDATA+"\Microsoft\Signatures"
    $path
    Copy-Item $path $usertemp -Recurse -Force
    Get-Item $usertemp 
    Write-Output "签名备份成功"
    Start-Sleep 3;exit
}
$usertemp=$usertemp+"\Signatures"
$usertemp
if(Test-Path $usertemp){
    $path=$env:APPDATA+"\Microsoft"
    Move-Item $usertemp $path -Force
    Remove-Item (Split-Path $usertemp) -Force
   Write-Output "签名还原成功"
    Start-Sleep 3
}

第一次运行会备份,第二次会还原,

powershell -nop -ep ByPass “%~dp0Signatures.ps1”

本文链接: https://www.pstips.net/powershell-%e5%a4%87%e4%bb%bd%e8%bf%98%e5%8e%9foutlook%e9%82%ae%e4%bb%b6%e7%ad%be%e5%90%8d.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

一条评论 “powershell 备份还原outlook邮件签名