Reflect PowerShell module


Author
Message
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)
Group: Forum Members
Posts: 3.6K, Visits: 27K
This idea is an extension of a wish made by @RefDM elsewhere.  Currently, Reflect adds a "Macrium Reflect" tab to the Properties pane of its backup files.  It contains quite a bit of useful information, but to my knowledge there is no way to retrieve any of it programmatically.  Since Reflect already includes some convenient functionality to help users run backups via scripts, I think a natural extension of that would be to make the information in that tab more available in a scripting context for the benefit of users who use scripts.  But then I thought of some other capabilities that could be extremely useful, so now I'm envisioning a PowerShell module that includes the following cmdlets:
  • Get-ReflectBackupProperties -- accepts one or more file or folder paths (including folder recursion support) and returns everything from the Macrium Reflect tab for all of those files.  The properties in the Summary section and the Comment could be returned as individual properties, and the area that shows what the backup contains could be returned as a collection.  The returned content should also include the full path to each file for the reason mentioned below.
  • Get-ReflectMatchingBackups -- accepts a specific file (with support for specifying the various matching options that apply to F&F matching) and returns the output of the above cmdlet for every other file in its containing folder that is part of a matching backup set. Since the file path would be included in the returned object, the output could be piped to other standard PowerShell cmdlets for copy/move/delete operations, and having the rest of the above cmdlet's output such as Backup Type and Backup Date would allow this cmdlet to be used for implementing retention policies outside of Reflect if a user's needs were more complex than Reflect supported.
  • Get-ReflectBackupSet -- accepts a specific file and returns the same output as above, but only for the files that are part of the same set.  I realize that getting all files in a single set can already be achieved somewhat easily with regular PowerShell as long as the user hasn't deliberately renamed their backup set files inconsistently, but it would still be handy.
  • Get-ReflectBackupChildren -- accepts a specific file and returns the same output as above for all files in the set that depend on that file.
  • Get-ReflectBackupParents -- accepts a specific file and returns the same output as above for all files in the set on which it depends.
  • Delete-ReflectBackup -- accepts a specific file, and if it has any child backups, lists them and prompts to confirm deleting those as well before proceeding.  Support a "-Force" parameter to delete child backups automatically and also a "-NoOrphan" parameter to automatically cancel this if a backup has dependent backups.
  • Consolidate-ReflectBackup -- accepts "From" and "To" files as well as a password (as a SecureString) if needed.

Edited 19 June 2018 8:27 PM by jphughan
RefDM
RefDM
Junior Member
Junior Member (89 reputation)Junior Member (89 reputation)Junior Member (89 reputation)Junior Member (89 reputation)Junior Member (89 reputation)Junior Member (89 reputation)Junior Member (89 reputation)Junior Member (89 reputation)Junior Member (89 reputation)
Group: Forum Members
Posts: 70, Visits: 191
Hear, hear! w00t

RayG
RayG
Advanced Member
Advanced Member (500 reputation)Advanced Member (500 reputation)Advanced Member (500 reputation)Advanced Member (500 reputation)Advanced Member (500 reputation)Advanced Member (500 reputation)Advanced Member (500 reputation)Advanced Member (500 reputation)Advanced Member (500 reputation)
Group: Forum Members
Posts: 243, Visits: 1.1K
jphughan - 19 June 2018 5:49 PM
Get-ReflectBackupProperties -- accepts one or more file or folder paths (including folder recursion support) and returns everything from the Macrium Reflect tab for all of those files.  The properties in the Summary section and the Comment could be returned as individual properties, and the area that shows what the backup contains could be returned as a collection.  The returned content should also include the full path to each file for the reason mentioned below.

This goes a little way to what you want:

https://gallery.technet.microsoft.com/scriptcenter/Get-ExtensionAttribute-ff7dc182?ranMID=24542&ranEAID=je6NUbpObpQ&ranSiteID=je6NUbpObpQ-1CL49dBMHsyeUX3rOKCDUw

Get-ExtensionAttribute -fullname "<Drive>\<Path>\<File>" -ExtensionAttribute BackupMethod,DateCreated,BackupComment

To get info on all the files use C:\Dir
To get info on a single file use: C:\Dir\BackupFile.mrimg

To get some extra info on the backup add the 'MacriumInfo' extension name:

Get-ExtensionAttribute -fullname "W:\Macrium Backup\Win10-x64\" -ExtensionAttribute MacriumInfo,'BackupMethod',DateCreated,'BackupComment'

I cant explain why including the "MacriumInfo" attribute produces useful information - in fact any non existing attribute will produce the same result.

However, To make this bit work you need to comment out line 77:
#$AttributeValues = New-Object System.Management.Automation.ValidateSetAttribute($Values)

Otherwise Powershell says the item you want is not in the list of valid values



Regards
RayG
Windows10 X64 V1809 B17763.55 MR v7.1.3317

Edited 20 June 2018 3:49 PM by RayG
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)Macrium Evangelist (5.3K reputation)
Group: Forum Members
Posts: 3.6K, Visits: 27K
Nice find!  That would definitely help @RefDM with his original wish to have a way to determine the type of backup.  However, it does seem to have some issues.  First, the DateCreated attribute corresponds to the Windows timestamp of the same name not the Backup Date/Time.  I have a Synthetic Full set that began over a year ago but whose current Backup Date is a few weeks ago; the date shown by DateCreated is the former.  I tried using "BackupTime" and "BackupDate", but neither pulled that info.

Additionally, although the BackupMethod and BackupComment fields return properly when I run this on a Server 2016 system, when I run this on my Win10 1803 system against the exact same backup file, those attributes return identical copies of the MacriumInfo content, i.e. more than what's expected and the Backup Comment nowhere to be found, just as if they were non-existent attribute names.  I haven't dug into that one yet, but I didn't even know something like this was possible, so thanks for pointing me to it!

And RefDM, now that this is available, assuming it works as expected on your PC as well, if you want any help building a script that does something based on the backup type now that there's a way to pull it in a scripting environment, feel free to PM! Smile


Edited 20 June 2018 4:43 PM by jphughan
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search