Powershell question

  • Hi, I'm trying to use Powershell scripting to monitor SQL Server 2008 and I tried the below:

    $mydate=get-date

    $mydate.year

    $mydate.month

    $mydate.day

    $mydate.day+1

    PS C:\> $mydate=get-date

    PS C:\> $mydate.year

    2011

    PS C:\> $mydate.month

    2

    PS C:\> $mydate.day

    28

    PS C:\> $mydate.day+1

    29

    PS C:\>

    Here, when I tried the last command $mydate.day+1, it's giving me the result as 29 which does not exist in Feb month. How to resolve this?

    I want to see the result as March 1st

    Thanks

  • I got it.

    $mydate= get-date.Adddays(1)

    Thanks

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply