Wednesday, November 2, 2011

Get User Name from User Information List using PowerShell

Leave a Comment
Execute following script in Power Shell and get value of Name Field from User Information List

PS > $site = Get-SPSite("Site URL");
         $web = $site.OpenWeb( );
         $list =  $web.Lists["User Information List"]

          // Here i am getting item by id but we can also use SPQuery object to get item from user information list and get SPListItem object.

         $listitem = $list.GetItemByID(1);
          
         Write-Host  $listitem["Name"]; 

0 comments: