PowerShell script exchange
Post Reply
Ant
Novice
Posts: 6
Liked: never
Joined: Dec 07, 2017 10:07 pm
Full Name: Anthony Richardson

Start-VBRWindowsFileRestore creates mount point but it is not visible in explorer

Post by Ant »

I am seeing something weird in that Start-VBRWindowsFileRestore indicates it has created a mount point but it does not appear in explorer. The GUI produces a mount point in explorer so I am not sure if I am using the correct commands, correctly, or if I have an actual bug in the PS command. Any suggestions would be appreciated. I am using 11.0.0.837 P20210525

Code: Select all




function vbr-testrestore{
	param(
		$VBRServer = "myvbr11server",
		$TargetVM = "mybackedupvmserver",
		$TargetDrive = "D:",
		$TargetFile = "\path\file.txt",
		$RestoreFile = "F:\restorepath\file.txt"
	)
	process{
		$RestorePoint = Get-VBRRestorePoint | ?{$_.name -eq $TargetVM} | Sort CreationTime -Descending | Select -First 1
		$FileRestore = $RestorePoint | Start-VBRWindowsFileRestore
		$MountPoints = $FileRestore.MountSession.MountedDevices
		$MountPoints | foreach-object{
			$MountPoint = $_ | ?{$_.DriveLetter -eq $TargetDrive}
		}
		"Mount Point:-"
		$MountPoint
		if($MountPoint.isaccessible -eq $true){
			##	Copy-Item "$($MountPoint.mountpoint)$($TargetFile)" $RestoreFile
			"Items in FLR Folder"
			dir c:\veeamflr
			"Items in mount point"
			dir $MountPoint.mountpoint
		}
		Stop-VBRWindowsFileRestore $FileRestore
	}
}


clear
vbr-testrestore


Mildur
Product Manager
Posts: 9846
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Start-VBRWindowsFileRestore creates mount point but it is not visible in explorer

Post by Mildur »

If you do a Guest File Restore, the restore point will be mounted on the configured mount server in the backup repo settings. Please run the script again and check if the folder is mounted on the configured mount server of your backup repo.

Image
Product Management Analyst @ Veeam Software
Ant
Novice
Posts: 6
Liked: never
Joined: Dec 07, 2017 10:07 pm
Full Name: Anthony Richardson

Re: Start-VBRWindowsFileRestore creates mount point but it is not visible in explorer

Post by Ant »

Thanks for that golden nugget Mildur. I changed the mount server from the default due to restore software requirements and obviously it didn't even enter my mind. I would not even have known that I might have an issue if I hadn't. So it all works find now.

On a side note I also discovered that

Code: Select all

Get-VBRRestorePoint | ?{}
is much slower than

Code: Select all

Get-VBRRestorePoint -Name 

Code: Select all

function vbr-testrestore{
	param(
		$TargetVM = "mybackedupvmserver",
		$TargetDrive = "D:",
		$TargetFile = "\path\file.txt",
		$RestoreFile = "c:\restorepath\file.txt"
		$RepoJobName = "mybackupjob_Copy\mybackedupvmserver",
		$JobName = "mybackupjob_Copy"
	)
	process{
		$RestorePoint = Get-VBRRestorePoint -Name $TargetVM | ?{$_.getbackup().jobname -eq $RepoJobName} | Sort CreationTime -Descending | Select -First 1
		$FileRestore = $RestorePoint | Start-VBRWindowsFileRestore
		$MountPoints = $FileRestore.MountSession.MountedDevices
		$MountPoints | foreach-object{
			$MountPoint = $_ | ?{$_.DriveLetter -eq $TargetDrive}
		}
		$RestorePath = "\\$($RestorePoint.GetMountHost().Name)\$($MountPoint.MountPoint -replace ":","$")"
		copy-item "$($RestorePath)$($TargetFile)" $RestoreFile -Force
		Stop-VBRWindowsFileRestore $FileRestore
	}
}


clear
vbr-testrestore

Mildur
Product Manager
Posts: 9846
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Start-VBRWindowsFileRestore creates mount point but it is not visible in explorer

Post by Mildur »

Your welcome.
On a side note I also discovered that

Code: Select all

Get-VBRRestorePoint | ?{}
is much slower than

Code: Select all

Get-VBRRestorePoint -Name 
I would say, that is to expect.
The first one needs to load every restore point in to the powershell sessions, before any filtering is happening.
The second command filters the data before it‘s get loaded.
Product Management Analyst @ Veeam Software
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests