get the user name from document library who uploaded documents

HI

1) i want to get the details user names  who  uploaded  the documents from 8 to 9 PM  using power shell script

these users are domain users who uploaded documents.

April 26th, 2015 5:14am

Hi,

According to your description, my understanding is that you want to get the user name who upload documents between 8:00 pm and 9:00 pm using PowerShell.

I suggest you can use CAML Query to filter the document which created between 8:00 pm and 9:00 pm, then you can output the Created By column value to get the user who upload the documents.

Here is a code snippet for your reference:

$spweb = get-spweb http://sp2013sps/sites/test 
 $splist = $spweb.Lists.TryGetList("Documents") 
if ($splist) 
{ 
   $query = New-Object Microsoft.SharePoint.SPQuery; 
   $query.Query = 
   "   <Where>
      <And>
         <Geq>
            <FieldRef Name='Created' />
            <Value Type='DateTime' IncludeTimeValue='TRUE'>2015-04-27T9:00:00Z</Value>
         </Geq>
         <Leq>
            <FieldRef Name='Created' />
            <Value Type='DateTime' IncludeTimeValue='TRUE'>2015-04-27T12:00:00Z</Value>
         </Leq>
      </And>
   </Where>"; 
   $items = $splist.GetItems($query); 
   
   foreach($item in $items)
   {
      write-host $item["Created By"];
   
   
   }
}

Thanks

Best Regards

Free Windows Admin Tool Kit Click here and download it now
April 27th, 2015 12:24am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics