Skip to content

Instantly share code, notes, and snippets.

@kkamegawa
Created November 15, 2015 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkamegawa/3342dbb8e5716fafa7e3 to your computer and use it in GitHub Desktop.
Save kkamegawa/3342dbb8e5716fafa7e3 to your computer and use it in GitHub Desktop.
create backup file list to HTML in Windows Server 2012 R2.
$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