Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Looking Ahead
>
Using PowerShell v2.0
Backup strategy
Last Post 31 Aug 2010 05:23 AM by
Solanas
. 2 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
Solanas
New Member
Posts:2
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)
Veteran Member
Posts:1647
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
Solanas
New Member
Posts:2
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.
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
Looking Ahead
>
Using PowerShell v2.0
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2