Created
November 15, 2015 04:00
-
-
Save kkamegawa/3342dbb8e5716fafa7e3 to your computer and use it in GitHub Desktop.
create backup file list to HTML in Windows Server 2012 R2.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$OnPremisePolicy = Get-WBPolicy | |
$Backups = @{ | |
Folder = $Folder | |
FileName = $FileName | |
} | |
$BackupList = @() | |
foreach($backup in $OnPremisePolicy){ | |
foreach($File in $OnPremisePolicy.FilesSpecsToBackup){ | |
$BackupFile = New-Object psobject -Property $Backups | |
$BackupFile.Folder = $File.FilePath | |
$backupFile.FileName = $file.FileName | |
$BackupList += $BackupFile | |
} | |
} | |
if((@(Get-Command | where {$_.name -eq "Get-ObPolicy"}).Count) -eq 1) { | |
$AzurePolicy = Get-OBPolicy | |
foreach($backup in $AzurePolicy){ | |
foreach($DsLists in $backup.DsList){ | |
foreach($Dataset in $DsLists.SpecList){ | |
$BackupFile = New-Object psobject -Property $Backups | |
$BackupFile.Folder = $Dataset.FileSpec | |
$backupFile.FileName = $Dataset.FileName | |
$BackupList += $BackupFile | |
} | |
} | |
} | |
} | |
$HtmlFile = ".\" + [environment]::MachineName + '_backupFiles.html' | |
$BackupList | ConvertTo-Html -Title "WIndows Backup File List" -as Table > $HtmlFile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment