locked
get-qadcomputer lastLogontimestamp and whenCreated in format даты dd/mm/yyyy RRS feed

  • Question

  • Hi folks,

    there is the script:

    $InactiveDays = New-TimeSpan -days 90
    $LastLogonTimeMark = (get-date) - $InactiveDays

    Get-QADComputer -SearchRoot 'tr.technion.ac.il/Metal Institute' -IncludedProperties lastLogontimeStamp, useraccountcontrol|
    ?{$_.lastLogontimeStamp -lt $LastLogonTimeMark}|
    select name, lastLogontimeStamp, whenCreated, @{Name="Disabled"; Exp={$_.useraccountcontrol -band 2}}|
    ?{$_.Disabled -eq 0}|
    sort lastLogontimeStamp | ft Name,lastLogontimestamp,whenCreated -AutoSize

    Iwould like to receive
    lastLogontimestamp and whenCreated Values in the format dd/mm/yyyy


    nesher13

    • Moved by Bill_Stewart Saturday, January 17, 2015 8:28 PM Abandoned
    Thursday, November 27, 2014 11:37 AM

All replies

  • Whencreated should already be in that format and you can substitute lastlogontimestamp for lastlogondate - they show the same value but lastlogondate is already converted to a readable date.
    Thursday, November 27, 2014 12:05 PM
  • You would need to use calculated properties to convert the format

    Select-Object @{N='WhenCreates';E={$_.weehnCreated.ToString('dd/MM/yyyy')}}

    Start with:

    HELP Select-Object -Full


    ¯\_(ツ)_/¯

    Thursday, November 27, 2014 12:05 PM