Output user certificates and direct reports via powershell

Hi,

1- I need to export published certificates (Intended Purposes , Expiration Date) that i can see in the published certificates tab from user properties in Active Directory. could you let me know how to export all theses attributes per user using a powershell script please.

2- How to get displayname from direct reports attribute ?

My Desired output :

 givenName,sn,.... , Intended Purposes , Expiration Date ,Direct Report Bob,Smith,...... , Client Authentication , 12/12/2020 , Alex Darrow;Corey Roth 

Here is my script so far:

 Get-ADUser -Filter {Enabled -eq $true} -Properties * | Select givenName, sn, displayname ,samaccountname ,@{Name="MemberOf";Expression={($_.MemberOf | %{(Get-ADGroup $_).sAMAccountName}) -Join ";"}}, DistinguishedName ,city ,state , pager, postalcode ,country, streetaddress, mobile, ipphone, Fax , physicaldeliveryofficename,title, company ,description ,department ,homePhone , mail, @{n=”Manager Name”;e={(Get-ADuser -identity $_.Manager -properties displayname).DisplayName}}, @{n=”Manager Emp ID”;e={(Get-ADuser -identity $_.Manager -properties employeeid).employeeid}},enabled, @{n='LastLogon';e={[DateTime]::FromFileTime($_.LastLogon)}} , employeeid , employeeType ,EmployeeNumber ,Passwordneverexpires, whenCreated, whenChanged , userPrincipalName , canonicalname ,@{n='directReports';e={$_.directreports -join '; '}} | Export-Csv -Path "c:tempall_users_list.csv" -NoTypeInformation -Encoding UTF8 

Regards,

submitted by /u/maxcoder88
[link] [comments]

Leave a Reply