PowerShell script exchange
Post Reply
lrhazi
Enthusiast
Posts: 40
Liked: never
Joined: Jan 03, 2017 8:15 pm
Full Name: Mohamed Lrhazi
Contact:

How to check status of Start-VBRInstantRecovery?

Post by lrhazi » Jan 26, 2019 6:56 am

When you call this function, how do you check that it succeeded?

It does not appear to return a result object.

veremin
Product Manager
Posts: 17047
Liked: 1470 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to check status of Start-VBRInstantRecovery?

Post by veremin » Jan 28, 2019 2:05 pm

You can get a restore session using Get-VBRRestoreSession cmdlet and check its result by querying result parameter. Thanks!

lrhazi
Enthusiast
Posts: 40
Liked: never
Joined: Jan 03, 2017 8:15 pm
Full Name: Mohamed Lrhazi
Contact:

Re: How to check status of Start-VBRInstantRecovery?

Post by lrhazi » Jan 28, 2019 5:43 pm

I see that I can query for existing sessions, with Get-VBRInstantRecovery, but how do I know which session is the one I just started, or failed to start ?

lrhazi
Enthusiast
Posts: 40
Liked: never
Joined: Jan 03, 2017 8:15 pm
Full Name: Mohamed Lrhazi
Contact:

Re: How to check status of Start-VBRInstantRecovery?

Post by lrhazi » Jan 28, 2019 5:45 pm

I can filter by VM name, but still, what if there many running already, for the same VM ? How do I tell which one is really the one I just started or failed to start?

veremin
Product Manager
Posts: 17047
Liked: 1470 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to check status of Start-VBRInstantRecovery?

Post by veremin » Jan 28, 2019 6:33 pm

You can assign result of Start-VBRInstantRecovery cmdlet execution to a variable and work with the variable afterwards (in order to be sure). Thanks!

lrhazi
Enthusiast
Posts: 40
Liked: never
Joined: Jan 03, 2017 8:15 pm
Full Name: Mohamed Lrhazi
Contact:

Re: How to check status of Start-VBRInstantRecovery?

Post by lrhazi » Jan 29, 2019 7:55 pm

Unfortunately, the cmdlet does not seem to return anything at all!

veremin
Product Manager
Posts: 17047
Liked: 1470 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to check status of Start-VBRInstantRecovery?

Post by veremin » Feb 05, 2019 11:52 am

Hmm, then, your only option is to run Get-VBRRestoreSession (returns all sessions) or Get-VBRInstantRecovery (returns only currently running sessions) and filter them based on CreationTime parameter - the latest one should be the one that has been just started. Returned session object also has different result and state parameters that should give you clues on whether the execution went successfully or not. Thanks!

lrhazi
Enthusiast
Posts: 40
Liked: never
Joined: Jan 03, 2017 8:15 pm
Full Name: Mohamed Lrhazi
Contact:

Re: How to check status of Start-VBRInstantRecovery?

Post by lrhazi » Feb 05, 2019 2:43 pm

Thanks a lot Vladimir. I will do that... The right way would have been for the Cmdlet to return an object that reliably identifies the session it started.

veremin
Product Manager
Posts: 17047
Liked: 1470 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to check status of Start-VBRInstantRecovery?

Post by veremin » Feb 05, 2019 5:49 pm

If you use -RunAsync switch, cmdlet will return an object, but the object doesn't have any creationtime parameter, so it will be useless for your goal. Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest