Posted on Leave a comment

Using LogParser to get list of Sharepoint Usernames

Download and install LogParser from here:

https://www.microsoft.com/en-us/download/details.aspx?id=24659

Then create a text file query.sql containing your query


   SELECT distinct 
          replace_str(replace_str(to_lowercase(cs-username),'0#.f|ldapmember|',''),'0#.w|','') as username
     FROM C:\inetpub\logs\LogFiles\*.log
    WHERE cs-username > ''
      AND date >= '2017-01-01'

 

Then execute the following command

C:\Program Files (x86)\Log Parser 2.2\logparser file:"query.sql" -i:IISW3C -o:CSV -recurse > c:\temp\usernames.csv

(note: path to LogParser may vary on your system, it may also be handy to add it to the %PATH%)

Learn more about LogParser here:
https://technet.microsoft.com/en-us/scriptcenter/dd919274.aspx

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.