Microsoft Virtualization Discussions

Converting the dates from DataOnTap results?

has anyone had any success parsing the dates returned from some DataOnTap cmdlets?

In particular, the LastOperationEnd date value returned from Get-NAVolSis which, annoyingly, returns a string value containing the Timezone info (e.g. CEST 2014) which .NET/Powerhsell doesn't handle at all well

edit: I notice some other cmdlets (get-NaSnapshot for example, return a proper datetime value).  Why doesn't Get-NaSISVol do the same?  This seems like a glaring inconsistency to me.

7 REPLIES

Re: Converting the dates from DataOnTap results?

Matt -

Interesting... you can always created a custom object and redo it if you want, but why would we do that :-)

What exactly do you need the system.datetime for in this cmdlet?

Re: Converting the dates from DataOnTap results?

I'm writing a script to monitor certain things on our filers.  One of the requirements is to check that the dedupe ran within the last 24 hours.

I've since found that I can use Get-NASis <volname> and that returns a DT formatted value (LastOperationEndTimestampDT).  That's a proper datetime value which gives me what I want.  It just seems strange that Get-NaSISVol (which, as far as I can tell does much the same thing as Get-NASis) returns a string value instead of datetime value.

Re: Converting the dates from DataOnTap results?

Yes, interesting find, I never had the need to do that..  

Once your done, if you don't mind sharing with the community

Re: Converting the dates from DataOnTap results?

Sure.  It's a bit rough but it does the job

        $Volumes=Get-NaVol
        ForEach ($volume in $Volumes)
        {
            $VolumeName=$volume.name
            $ASISInfo=Get-NASIS "/vol/$Volumename" -erroraction silentlycontinue

            If ($ASISInfo)
            {
                If ($AsisInfo.LastOperationState -ne "success")
                {
                    [string]$ASISError=$ASISInfo.LastOperationError
                    "ASIS last operation failed ($ASISError)"
                }

                $LastASISDate=$ASISInfo.LastOperationEndTimestampDT
               
                If ($LastASISDate)
                {
                    If ($LastASISDate -lt (Get-Date).AddHours(-24))
                    {
                        "lastasisdate is bad"
                    }
                }
            }   
        }

Re: Converting the dates from DataOnTap results?

Cool. are you dumping the information to a log and emailing you?

Re: Converting the dates from DataOnTap results?

No it's being used in a script that sends information to our monitoring server.  It'll flag the particular alert as red if the Dedupe didn't run in the last 24 hours.

Re: Converting the dates from DataOnTap results?

Cool

Forums