Skip to content

Commit 8ef52e7

Browse files
Update backup-client-automation.md
Updated powershell commands for restoring a file, with the latest valid cmdlets.
1 parent 9b63da0 commit 8ef52e7

File tree

1 file changed

+37
-71
lines changed

1 file changed

+37
-71
lines changed

articles/backup/backup-client-automation.md

Lines changed: 37 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Use PowerShell to back up Windows Server to Azure
33
description: In this article, learn how to use PowerShell for setting up Azure Backup on Windows Server or a Windows client, and managing backup and recovery.
44
ms.topic: conceptual
5-
ms.date: 08/20/2019
5+
ms.date: 12/2/2019
66
---
77
# Deploy and manage backup to Azure for Windows Server/Windows Client using PowerShell
88

@@ -563,7 +563,7 @@ This section will guide you through the steps for automating recovery of data fr
563563

564564
1. Pick the source volume
565565
2. Choose a backup point to restore
566-
3. Choose an item to restore
566+
3. Specify an item to restore
567567
4. Trigger the restore process
568568

569569
### Picking the source volume
@@ -587,95 +587,61 @@ ServerName : myserver.microsoft.com
587587

588588
### Choosing a backup point from which to restore
589589

590-
You retrieve a list of backup points by executing the [Get-OBRecoverableItem](https://technet.microsoft.com/library/hh770399.aspx) cmdlet with appropriate parameters. In our example, we’ll choose the latest backup point for the source volume *D:* and use it to recover a specific file.
590+
You retrieve a list of backup points by executing the [Get-OBRecoverableItem](https://technet.microsoft.com/library/hh770399.aspx) cmdlet with appropriate parameters. In our example, we’ll choose the latest backup point for the source volume *C:* and use it to recover a specific file.
591591

592592
```powershell
593-
$Rps = Get-OBRecoverableItem -Source $Source[1]
593+
$Rps = Get-OBRecoverableItem $Source[0]
594+
$Rps
594595
```
595596

596597
```Output
597-
IsDir : False
598-
ItemNameFriendly : D:\
599-
ItemNameGuid : \?\Volume{b835d359-a1dd-11e2-be72-2016d8d89f0f}\
600-
LocalMountPoint : D:\
601-
MountPointName : D:\
602-
Name : D:\
603-
PointInTime : 18-Jun-15 6:41:52 AM
604-
ServerName : myserver.microsoft.com
605-
ItemSize :
598+
599+
IsDir : False
600+
ItemNameFriendly : C:\
601+
ItemNameGuid : \\?\Volume{297cbf7a-0000-0000-0000-401f00000000}\
602+
LocalMountPoint : C:\
603+
MountPointName : C:\
604+
Name : C:\
605+
PointInTime : 10/17/2019 7:52:13 PM
606+
ServerName : myserver.microsoft.com
607+
ItemSize :
606608
ItemLastModifiedTime :
607609
608-
IsDir : False
609-
ItemNameFriendly : D:\
610-
ItemNameGuid : \?\Volume{b835d359-a1dd-11e2-be72-2016d8d89f0f}\
611-
LocalMountPoint : D:\
612-
MountPointName : D:\
613-
Name : D:\
614-
PointInTime : 17-Jun-15 6:31:31 AM
615-
ServerName : myserver.microsoft.com
616-
ItemSize :
610+
IsDir : False
611+
ItemNameFriendly : C:\
612+
ItemNameGuid : \\?\Volume{297cbf7a-0000-0000-0000-401f00000000}\
613+
LocalMountPoint : C:\
614+
MountPointName : C:\
615+
Name : C:\
616+
PointInTime : 10/16/2019 7:00:19 PM
617+
ServerName : myserver.microsoft.com
618+
ItemSize :
617619
ItemLastModifiedTime :
618620
```
619621

620622
The object `$Rps` is an array of backup points. The first element is the latest point and the Nth element is the oldest point. To choose the latest point, we will use `$Rps[0]`.
621623

622-
### Choosing an item to restore
623-
624-
To identify the exact file or folder to restore, recursively use the [Get-OBRecoverableItem](https://technet.microsoft.com/library/hh770399.aspx) cmdlet. That way the folder hierarchy can be browsed solely using the `Get-OBRecoverableItem`.
625-
626-
In this example, if we want to restore the file *finances.xls* we can reference that using the object `$FilesFolders[1]`.
627-
628-
```powershell
629-
$FilesFolders = Get-OBRecoverableItem $Rps[0]
630-
$FilesFolders
631-
```
624+
### Specifying an item to restore
632625

633-
```Output
634-
IsDir : True
635-
ItemNameFriendly : D:\MyData\
636-
ItemNameGuid : \?\Volume{b835d359-a1dd-11e2-be72-2016d8d89f0f}\MyData\
637-
LocalMountPoint : D:\
638-
MountPointName : D:\
639-
Name : MyData
640-
PointInTime : 18-Jun-15 6:41:52 AM
641-
ServerName : myserver.microsoft.com
642-
ItemSize :
643-
ItemLastModifiedTime : 15-Jun-15 8:49:29 AM
644-
```
626+
To restore a specific file, specify the file name relative to the root volume. For example, to retreive C:\Test\Cat.job, execute the following command.
645627

646628
```powershell
647-
$FilesFolders = Get-OBRecoverableItem $FilesFolders[0]
648-
$FilesFolders
629+
$Item = New-OBRecoverableItem $Rps[0] "Test\cat.jpg" $FALSE
630+
$Item
649631
```
650632

651633
```Output
652-
IsDir : False
653-
ItemNameFriendly : D:\MyData\screenshot.oxps
654-
ItemNameGuid : \?\Volume{b835d359-a1dd-11e2-be72-2016d8d89f0f}\MyData\screenshot.oxps
655-
LocalMountPoint : D:\
656-
MountPointName : D:\
657-
Name : screenshot.oxps
658-
PointInTime : 18-Jun-15 6:41:52 AM
659-
ServerName : myserver.microsoft.com
660-
ItemSize : 228313
661-
ItemLastModifiedTime : 21-Jun-14 6:45:09 AM
662-
663-
IsDir : False
664-
ItemNameFriendly : D:\MyData\finances.xls
665-
ItemNameGuid : \?\Volume{b835d359-a1dd-11e2-be72-2016d8d89f0f}\MyData\finances.xls
666-
LocalMountPoint : D:\
667-
MountPointName : D:\
668-
Name : finances.xls
669-
PointInTime : 18-Jun-15 6:41:52 AM
670-
ServerName : myserver.microsoft.com
671-
ItemSize : 96256
634+
IsDir : False
635+
ItemNameFriendly : C:\Test\cat.jpg
636+
ItemNameGuid :
637+
LocalMountPoint : C:\
638+
MountPointName : C:\
639+
Name : cat.jpg
640+
PointInTime : 10/17/2019 7:52:13 PM
641+
ServerName : myserver.microsoft.com
642+
ItemSize :
672643
ItemLastModifiedTime : 21-Jun-14 6:43:02 AM
673-
```
674644
675-
You can also search for items to restore using the ```Get-OBRecoverableItem``` cmdlet. In our example, to search for *finances.xls* we could get a handle on the file by running this command:
676-
677-
```powershell
678-
$Item = Get-OBRecoverableItem -RecoveryPoint $Rps[0] -Location "D:\MyData" -SearchString "finance*"
679645
```
680646

681647
### Triggering the restore process

0 commit comments

Comments
 (0)