header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Backup strategy
Last Post 31 Aug 2010 05:23 AM by Solanas. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SolanasUser is Offline
New Member
New Member
Posts:2
Avatar

--
31 Aug 2010 03:20 AM
    Dear all,

    i´m a newbie in Powershell and try to create a backup strategy with Powershell.
    i will create an backup on every last thursday in month.
    now my question.
    how can i start such a script?

    do i need first the current-date and then type get-date to get the time between the last thursday in month and the current date?

    thanks in advance...

    Andy

    Marco Shaw (MVP)User is Offline
    Veteran Member
    Veteran Member
    Posts:1647
    Avatar

    --
    31 Aug 2010 05:05 AM
    This logic works for today, so should work in your case also:

    $day=(Get-Date).DayOfWeek
    $month=(Get-Date).Month

    $next=((Get-Date).AddDays(7)).Month

    if($next -ne $month){"Last day of month"}
    Marco

    *Microsoft MVP - Windows PowerShell
    https://mvp.support.microsoft.com/profile/Marco.Shaw
    *Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
    *Blog - http://marcoshaw.blogspot.com
    SolanasUser is Offline
    New Member
    New Member
    Posts:2
    Avatar

    --
    31 Aug 2010 05:23 AM
    thank you Marco.
    but can you explain it a little bit more, please. i´m a newbie with powershell and would like to create a backup every thursday in a month.

    i try.
    $day=(Get-Date).DayOfWeek - so i need to confirm this is thursday?
    $month=(Get-Date).Month - so it should be every month in a year

    $next=((Get-Date).AddDays(7)).Month - here i should confirm for thursday not 7 but 4 for thursday?

    thank you...

    Andy


    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer