Saturday, December 28, 2013

Backup Windows 8.1

Here is a short little PowerShell Function that I use to create a scheduled job that runs every night at midnight that backups my C:\ drive to my E:\ drive.

The code used to backup Windows 8.1:
wbAdmin start backup -backupTarget:E: -include:C: -quiet

Function Create-ScheduledJob {
   schedules nightly backups.
   PowerShell v3.0+
    Param( [Parameter( Mandatory = $True )]
           [Parameter( Mandatory = $True )]
           $VerbosePreference = "Continue" )

Begin{ $Trigger = (New-JobTrigger -Daily -At 12:01AM) }

Process{ Register-ScheduledJob -Name $JobName -Trigger $Trigger -ScriptBlock { "& wbAdmin start backup -backupTarget:E: -include:C: -quiet" } }

End { Write-Verbose "Your new ScheduledJob has been created successfully!" }