Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## source https://forums.veeam.com/veeam-backup-replication-f2/vib-files-are-left-behind-t72166.html
- ## build list of all restorepoints in Veeam DB
- $vbrrp = Get-VBRRestorePoint
- ## query storage backing of RPs
- $vbrrpstorage = $vbrrp.findstorage()
- ##manually list out repo filesystem items
- $root = "\\UNCpath\f$\"
- $drive = "F"
- $volume = "$($drive):\"
- New-PSDrive -Root $root -PSProvider FileSystem -Name $drive -Credential $cred
- $repofiles=gci $volume -File -Recurse -Include @('*.temp','*.vbk','*.vib')
- remove-psdrive $drive
- ##Compare file system to db RPs.
- $badfiles=$repofiles|?{$vbrrpstorage.PartialPath.elements -NotContains $_.name}
- ## use clipboard to transfer file info to repo
- $badfiles| select name,fullname,directoryname|ConvertTo-Csv | clip
- ## on repo build file list
- $badfiles= Get-Clipboard |ConvertFrom-Csv
- ## instead of immediately hard deleting files, move to a temp directory
- ## create map file to replace UNC path with local drive
- $map=@()
- $badfiles | %{$map +=New-Object PSObject -Property @{
- source = $_.fullname.replace($root,$volume)
- destination = $_.fullname.replace($root+"ARCHIVE",$volume+"badfiles")
- dir = $_.directoryname.replace($root+"ARCHIVE",$volume+"badfiles")
- }
- }
- ## create sub dirs and move files out of Repo path
- $map|% {if (!(test-path $_.dir)){New-Item -ItemType Directory -Path $_.dir }
- Move-Item -Path $_.source -Destination $_.destination}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement