PowerShell script exchange
dmichael
Novice
Posts: 9 Liked: never
Joined: Sep 26, 2015 3:55 am
Contact:
Post
by dmichael » Sep 26, 2015 4:15 am
this post
Hi!
I make script:
Code: Select all
$computer = "comp"
$jobname = "job"
$bdate="*09/10/2015*"
$restoreto="E:\BackupCB\10.09.2015\"
$result=Get-VBRBackup | where {$_.jobname -eq "$jobname"} | Get-VBRRestorePoint | where {$_.name -eq "$computer"}| Where-Object {$_.CreationTime -like $bdate} | Select-Object -First 1 | Start-VBRWindowsFileRestore
$flrmountpoint = $result.MountSession.MountedDevices.MountPoint
Copy "C:\VeeamFLR\NPFSQL\Volume4\base.mdf" $restoreto
Stop-VBRWindowsFileRestore $result
But after Start-VBRWindowsFileRestore result:
Code: Select all
PS C:\Users\Administrator> C:\Users\Administrator\Documents\get-backup.ps1
VM Name Mounted Drives Size
------- -------------- ----
comp ...LR\comp\Volume4 1,8 TB
PS C:\Users\Administrator>
And other commands (copy and Stop-VBRWindowsFileRestore) dont run!
WTF?
veremin
Product Manager
Posts: 20413 Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Sep 28, 2015 3:03 pm
this post
You might want to open a PS console, run them one by one and see which one fails and with what error, since Stop-VBRWindowsFileRestore doesn't work, it must be the fifth line $result? Also, are you sure the "C:\VeeamFLR\NPFSQL\Volume4\base.mdf" exists on a file system after WinFLR has been started? $flrmountpoint line doesn't seem to be used within the script at all (it only gets the said variable assigned - that's all). Thanks.
dmichael
Novice
Posts: 9 Liked: never
Joined: Sep 26, 2015 3:55 am
Contact:
Post
by dmichael » Sep 29, 2015 5:28 am
this post
The script just finishes after Start-VBRWindowsFileRestore. In GUI you can see that restore session is running.
If you execute copy, once Start-VBRWindowsFileRestore has done its job, then, the files will be copied successfully. The path C:\VeeamFLR does exist.
dmichael
Novice
Posts: 9 Liked: never
Joined: Sep 26, 2015 3:55 am
Contact:
Post
by dmichael » Sep 29, 2015 6:28 am
this post
$flrmountpoint = $result.MountSession.MountedDevices.MountPoint doesn't get executed (I've just inserted it to check).
veremin
Product Manager
Posts: 20413 Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Sep 30, 2015 1:51 pm
this post
So, if you run a script line by line, everything will work, as expected? Try to run script automatically, using administrator account (if you haven't done it already). Also, it might be worth adding a waiting timeout after $Result line just to check whether WinFLR has been started correctly prior to proceeding to subsequent lines:
Code: Select all
$result = <.....>
Start-Sleep -s 30
Kindly, use English language, while writing on these forums. (that's the only language acceptable here)
Thanks.
dmichael
Novice
Posts: 9 Liked: never
Joined: Sep 26, 2015 3:55 am
Contact:
Post
by dmichael » Oct 01, 2015 5:56 am
this post
I run script useing administrator account.
Start-Sleep - s 30 dont working.
After run Start-VBRWindowsFileRestore:
Code: Select all
PS C:\Users\Administrator> C:\Users\Administrator.NPFO\Documents\get-npfsql.ps1
Id : 2bfd6187-b0f4-42ca-abb6-c0148e4e2ed2
MountPoint : C
Drives : C:\VeeamFLR\comp\Volume0, C:\VeeamFLR\comp\Volume1, C:\VeeamFLR\comp\Volume2, C:\VeeamFLR
\comp\Volume3, C:\VeeamFLR\comp\Volume4
VmName : NPFSQL
Size : 1,8 TB
CreationTime : 19.09.2015 22:17:28
Oib : Veeam.Backup.Core.COib
MountSession : Veeam.Backup.PowerShell.Model.CToIMountSessionAdapter
PS C:\Users\Administrator>
And script stop.
dmichael
Novice
Posts: 9 Liked: never
Joined: Sep 26, 2015 3:55 am
Contact:
Post
by dmichael » Oct 01, 2015 6:17 am
this post
I find problem.
I delete from script pipe "Select-Object -First 1" and all commands in script run!
veremin
Product Manager
Posts: 20413 Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Oct 01, 2015 10:43 am
this post
Hmm, looks strange. Just out of curiosity - what will be returned if you run this line? A valid restore point? Null object or something different?
Code: Select all
Get-VBRBackup | where {$_.jobname -eq "$jobname"} | Get-VBRRestorePoint | where {$_.name -eq "$computer"}| Where-Object {$_.CreationTime -like $bdate} | Select-Object -First 1
Thanks.
dmichael
Novice
Posts: 9 Liked: never
Joined: Sep 26, 2015 3:55 am
Contact:
Post
by dmichael » Oct 02, 2015 11:05 am
this post
I have result:
Code: Select all
Info : Veeam.Backup.Model.COibInfo
Id : c0da261d-f6e7-4d2f-8bc3-f94485aa66b5
LinkIdNullable : 98490183-369c-4e54-91ef-4b24f9e17a84
OriginalOibId : c0da261d-f6e7-4d2f-8bc3-f94485aa66b5
LinkId : 98490183-369c-4e54-91ef-4b24f9e17a84
CreationTime : 01.10.2015 22:25:43
CreationTimeUtc : 01.10.2015 17:25:43
CreationTimeString : 01.10.2015 22:25:43
Type : Increment
Algorithm : Increment
PointId : 184e49e8-7526-4ca8-b31f-713ab2cb08a3
ObjectId : eb3087f1-8647-480d-9afd-90d68fdb1b1f
StorageId : 45ccb978-37b5-483f-9024-45692e1722d0
InsideDir : 72b3a2c5-695c-4bd1-9586-e26bea25c6ba (vm-17)
FailoverState :
IsCorrupted : False
IsConsistent : True
ApproxSize : 1957388353536
VmName : COMP
Name : COMP
State : Nothing
EffectiveMemoryMb : 30720
GuestInfo : Veeam.Backup.Model.CGuestInfo
AuxData : Veeam.Backup.Core.CViOibAuxData
ParentId : 00000000-0000-0000-0000-000000000000
DisplayName : COMP
HvAuxData :
HasIndex : True
HasExchange : False
HasSharePoint : False
HasSql : True
HasAd : False
AdditionalRestore : {}
Fqdn : comp
BackupId : 6e690071-3242-4c33-920e-04ef8032db4b
LinkableType : Oib
IsFull : False
veremin
Product Manager
Posts: 20413 Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Oct 05, 2015 9:40 am
this post
Strange, it seems to return a correct restore point. What if you assign it to a variable and try to initiate Windows FLR against it afterwards?
Code: Select all
$RestorePoint = Get-VBRBackup | where {$_.jobname -eq "$jobname"} | Get-VBRRestorePoint | where {$_.name -eq "$computer"}| Where-Object {$_.CreationTime -like $bdate} | Select-Object -First 1
$result = Start-VBRWindowsFileRestore -RestorePoint $RestorePoint
Thanks.
dmichael
Novice
Posts: 9 Liked: never
Joined: Sep 26, 2015 3:55 am
Contact:
Post
by dmichael » Oct 05, 2015 9:51 am
this post
Hi!
See result:
Code: Select all
PS C:\Users\Administrator> $RestorePoint = Get-VBRBackup | where {$_.jobname -eq "ALL"} | Get-VBRRestorePoint | where {$_.name -eq "comp"}| Where-Object {$_.CreationTime -like "*10/02/2015*"} | Select-Object -First 1
$result = Start-VBRWindowsFileRestore -RestorePoint $RestorePoint
Info : Veeam.Backup.Model.COibInfo
Id : 77799d9d-a22b-4ca4-9589-b86bed532f35
LinkIdNullable : 6f98de49-12d7-4a65-8137-bb4262e8b96c
OriginalOibId : 648a1d14-181f-4d7f-802c-91256f21dbd0
LinkId : 6f98de49-12d7-4a65-8137-bb4262e8b96c
CreationTime : 02.10.2015 22:03:26
CreationTimeUtc : 02.10.2015 17:03:26
CreationTimeString : 02.10.2015 22:03:26
Type : Rollback
Algorithm : Syntethic
PointId : 4f33b81e-83e8-4eb5-8828-d783dc4d7477
ObjectId : e2c832c3-a711-4b2c-8572-5263bedcc78b
StorageId : 1e14348d-f906-463e-b650-b133a0161d61
InsideDir : 72b3a2c5-695c-4bd1-9586-e26bea25c6ba (vm-20)
FailoverState :
IsCorrupted : False
IsConsistent : True
ApproxSize : 25770852352
VmName : comp
Name : comp
State : Nothing
EffectiveMemoryMb : 4096
GuestInfo : Veeam.Backup.Model.CGuestInfo
AuxData : Veeam.Backup.Core.CViOibAuxData
ParentId : 00000000-0000-0000-0000-000000000000
DisplayName : comp
HvAuxData :
HasIndex : True
HasExchange : False
HasSharePoint : False
HasSql : False
HasAd : True
AdditionalRestore : {}
Fqdn : comp
BackupId : 6e690071-3242-4c33-920e-04ef8032db4b
LinkableType : Oib
IsFull : False
PS C:\Users\Administrator>
veremin
Product Manager
Posts: 20413 Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Oct 05, 2015 10:48 am
this post
And no Windows FLR session got executed, right? Curious behaviour, indeed. By the way, what PS version are you using? I've seen some peculiar situations with PowerShell 2.0. Thanks.
dmichael
Novice
Posts: 9 Liked: never
Joined: Sep 26, 2015 3:55 am
Contact:
Post
by dmichael » Oct 05, 2015 10:52 am
this post
Yes, FLR Session don't executed.
Version 3.0
Code: Select all
PS C:\Users\Administrator> $host
Name : ConsoleHost
Version : 3.0
InstanceId : 89197a7b-449d-46b4-a495-d1a75a21478a
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : ru-RU
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
veremin
Product Manager
Posts: 20413 Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Oct 06, 2015 8:37 am
this post
And what output would look like if you disregard Select-Object portion? Will it be the same restore point (that you get with Select-Object -First 1) or different one?
Code: Select all
Get-VBRBackup | where {$_.jobname -eq "ALL"} | Get-VBRRestorePoint | where {$_.name -eq "comp"}| Where-Object {$_.CreationTime -like "*10/02/2015*"}
Thanks.
dmichael
Novice
Posts: 9 Liked: never
Joined: Sep 26, 2015 3:55 am
Contact:
Post
by dmichael » Oct 06, 2015 11:25 am
this post
Hi!
Result:
Code: Select all
PS C:\Users\Administrator.NPFO> Get-VBRBackup | where {$_.jobname -eq "ALL"} | Get-VBRRestorePoint | where {$_.name -eq "comp"}| Where-Object {$_.CreationTime -like "*10/02/2015*"}
Info : Veeam.Backup.Model.COibInfo
Id : 77799d9d-a22b-4ca4-9589-b86bed532f35
LinkIdNullable : 6f98de49-12d7-4a65-8137-bb4262e8b96c
OriginalOibId : 648a1d14-181f-4d7f-802c-91256f21dbd0
LinkId : 6f98de49-12d7-4a65-8137-bb4262e8b96c
CreationTime : 02.10.2015 22:03:26
CreationTimeUtc : 02.10.2015 17:03:26
CreationTimeString : 02.10.2015 22:03:26
Type : Rollback
Algorithm : Syntethic
PointId : 4f33b81e-83e8-4eb5-8828-d783dc4d7477
ObjectId : e2c832c3-a711-4b2c-8572-5263bedcc78b
StorageId : 1e14348d-f906-463e-b650-b133a0161d61
InsideDir : 72b3a2c5-695c-4bd1-9586-e26bea25c6ba (vm-20)
FailoverState :
IsCorrupted : False
IsConsistent : True
ApproxSize : 25770852352
VmName : comp
Name : comp
State : Nothing
EffectiveMemoryMb : 4096
GuestInfo : Veeam.Backup.Model.CGuestInfo
AuxData : Veeam.Backup.Core.CViOibAuxData
ParentId : 00000000-0000-0000-0000-000000000000
DisplayName : comp
HvAuxData :
HasIndex : True
HasExchange : False
HasSharePoint : False
HasSql : False
HasAd : True
AdditionalRestore : {}
Fqdn : comp
BackupId : 6e690071-3242-4c33-920e-04ef8032db4b
LinkableType : Oib
IsFull : False
PS C:\Users\Administrator.NPFO>
Users browsing this forum: No registered users and 10 guests