Extracting only date portion from LastLogonDate

后端 未结 2 1777
借酒劲吻你
借酒劲吻你 2021-01-24 13:18

I want to be able to isolate the date from the output of this Get-ADUser command:

Get-ADUser -identity johnd -properties LastLogonDate | Select-Object name, Last         


        
2条回答
  •  梦毁少年i
    2021-01-24 13:48

    Can you use variables? If so,

    PS>$hi=Get-ADuser -identity johnd -properties LastLogonDate|select-object name,LastLogonDate
    PS>$hi.LastLogonDate.ToShortDateString()
    3/21/2016
    PS>$hi.name
    John Doe
    

提交回复
热议问题