Skip to main content

Posts

Showing posts from October, 2019

Robocopy backup using Task Scheduler

Backup is a simple word that has a very good significant value in today’s digital world.

Unattended backup or automated backup is a good strategy, so the user or the whoever is managing the backup won't need to manually trigger the backup.
No data backup is a head-on strategy, that leads to catastrophe.
Backup is very, very important in today’s digital world. You will never know when a data disaster will strike.
The whole laptop will be lost, the hard drive will fail without any sign, a virus might corrupt the whole system or just simple mistake to overwrite or delete a data. All this scenario requires a backup rescue to recover the data.
Robocopy is a built-in command in Windows that does a pretty awesome job to backup or copy files.
Using Windows task scheduler, robocopy and Vbscript will create an important task to backup data.
How the three tools will be used, to backup data?
Robocopy – to backup or copy the files Vbscript – to hide the robocopy in the background while Roboc…

PowerShell Add Custom Result Property

PowerShell has its own or default format of displaying the results or the output of the cmdlets or PowerShell commands.
However, PowerShell is customisable, and the output property can be modified.
Example below, gets the name of the file and display the date only without the time.
PowerShell code snippet below filter a single  and gets its lastwrite date.

get-childitem "C:\Users\ps_testing\Documents" -filter IMXP2611.jpg -recurse |select Directory, Name, @{Name="LastWriteDate";   Expression={$_.LastWriteTime.ToString("yyyy-MM-dd")}} | ft -wrap

This can be modified using wildchars like "*", which filters all "jpg" regardless of filename.

get-childitem "C:\Users\ps_testing\Documents" -filter *.jpg -recurse |select Directory, Name, @{Name="LastWriteDate";   Expression={$_.LastWriteTime.ToString("yyyy-MM-dd")}} | ft -wrap

LastWriteDate == is a custom label for the output
yyyy-MM-dd == is a custom format that dis…