Powered by Blogger.

Wednesday, August 21, 2019

PowerShell Backup Script

0 comments
Solution I propose is simple and easy in use. It is a PowerShell script that copies files, that have changed, from one location to another.

####making Job trigger 
$triggers = New-JobTrigger -Daily -At 3:07PM
###Register backup scheduled 


Register-ScheduledJob -Name DailyBackups -Trigger $triggers -

### Data source 
ScriptBlock {Copy-Item C:\Admin-Data 

#### Detination where you want to copy backup 
d:\Backup$((Get-Date).ToFileTime()) -Recurse -Force -PassThru}

----------------------------------------------------------------------------------------------------------------------

$triggers = New-JobTrigger -Daily -At 3:07PM
Register-ScheduledJob -Name DailyBackups -Trigger $triggers -ScriptBlock {Copy-Item C:\Admin-Data d:\Backup$((Get-Date).ToFileTime()) -Recurse -Force -PassThru}

No comments:

Post a Comment