From bca3ccac96405fb70f0bf68ae4bf19233e295971 Mon Sep 17 00:00:00 2001 From: Patrick Canterino Date: Wed, 17 Jan 2018 18:49:33 +0100 Subject: [PATCH] - Removed the old `net use` lines as they are now saved in the Git history - Fixed the path for the differential backups --- dsmonrot.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dsmonrot.ps1 b/dsmonrot.ps1 index bb56cdf..b838d75 100644 --- a/dsmonrot.ps1 +++ b/dsmonrot.ps1 @@ -3,7 +3,7 @@ # # Author: Patrick Canterino # WWW: https://www.patrick-canterino.de/ -# https://github.com/pcanterino/dsmonrot/ +# https://github.com/pcanterino/dsmonrot # License: 2-Clause BSD License # # Drive Snapshot is copyright by Tom Ehlert @@ -95,13 +95,11 @@ if($smbDrive) { $smbCredential = New-Object System.Management.Automation.PSCredential($smbUser, $secSmbPassword) New-PSDrive -Name $smbDrive -PSProvider "FileSystem" -Root $smbPath -Credential $smbCredential -Persist -ErrorAction Stop - #net use "$smbDrive`:" $smbPath $smbPassword /user:$smbUser } else { Write-Host "Without credentials" New-PSDrive -Name $smbDrive -PSProvider "FileSystem" -Root $smbPath -Persist -ErrorAction Stop - #net use "$smbDrive`:" $smbPath } $smbConnected = $True @@ -149,7 +147,7 @@ if((Test-Path $backupTarget) -and (Test-Path $backupTargetFull) -and (Test-Path exit } - $dsArgs = @($disksToBackup, "$backupTargetFull\`$disk.sna", "-h$backupTargetFull\`$disk.hsh") + $dsAdditionalArgs + $dsArgs = @($disksToBackup, "$backupTargetDiff\`$disk.sna", "-h$backupTargetFull\`$disk.hsh") + $dsAdditionalArgs Write-Host $dsPath ($dsArgs -join " ") & $dsPath $dsArgs @@ -214,7 +212,6 @@ if($isDiff -eq $False -and $success -eq $True -and $keepMonths -ge 0) { if($smbConnected) { Write-Host "Disconnecting network drive" Remove-PSDrive $smbDrive - #net use "$smbDrive`:" /delete } if($emailOnError -and $errorMessages.Count -gt 0) { -- 2.34.1