Sunday, July 1, 2012

Audience compilation status not idle

Hi Guys,

We had a situation recently in our 2010 server, the audience compilation job status is always compiling and not changed to idle. After I tried several ways to investigate the issue, there is no luck.

After I tried in Google, found the below information to solve the issue.


Open SharePoint Management Shell

Note: Run as administrator

Execute:

$runjob=[Microsoft.Office.Server.Audience.AudienceJob]::RunAudienceJob($args);

From the output copy the Application ID of the respective User Profile Service Application

For e.g., f4c2b7e2-ce7b-465d-868f-66164af37013

The Audience Compilation is preceded by following executable: AudienceJob.exe and we can force stop or start the compilation using PowerShell.

To stop execute:

Audiencejob.exe f4c2b7e2-ce7b-465d-868f-66164af37013 0

Note: Application ID and 0 or 1 indicates Stop or Start

After we successfully stopped the audience job we then started a full compilation executing following

Audiencejob.exe f4c2b7e2-ce7b-465d-868f-66164af37013 1



MOSS 2007: Power shell script for finding sub sites memory

Hi Guys,

I had a requirement from my client to provide them the report contains all the sub sites memory consumption in a site collection.
In Moss 2007, we don't have any OOTB to find the memory consumption for each sub site.

After tried in Google, I found the below power shell script that could be useful .


 function GetWebSizes ($StartWeb)  
 {  
   $web = Get-SPWeb $StartWeb  
   [long]$total = 0  
   $total += GetWebSize -Web $web  
   $total += GetSubWebSizes -Web $web  
   $totalInMb = ($total/1024)/1024  
   $totalInMb = "{0:N2}" -f $totalInMb  
   $totalInGb = (($total/1024)/1024)/1024  
   $totalInGb = "{0:N2}" -f $totalInGb  
   write-host "Total size of all sites below" $StartWeb "is" $total "Bytes,"  
   write-host "which is" $totalInMb "MB or" $totalInGb "GB"  
   $web.Dispose()  
 }  


 function GetSubWebSizes ($Web)  
 {  
   [long]$subtotal = 0  
   foreach ($subweb in $Web.GetSubwebsForCurrentUser())  
   {  
     [long]$webtotal = 0  
     foreach ($folder in $subweb.Folders)  
     {  
       $webtotal += GetFolderSize -Folder $folder  
     }  
     write-host "Site" $subweb.Title "is" $webtotal "Bytes"  
     $subtotal += $webtotal  
     $subtotal += GetSubWebSizes -Web $subweb  
   }  
   return $subtotal  
 }  

 function GetFolderSize ($Folder)  
 {  
   [long]$folderSize = 0   
   foreach ($file in $Folder.Files)  
   {  
     $folderSize += $file.Length;  
   }  
   foreach ($fd in $Folder.SubFolders)  
   {  
     $folderSize += GetFolderSize -Folder $fd  
   }  
   return $folderSize  
 }  

After you run the above scripts together, you can call it with the following PowerShell command: GetWebSizes -StartWeb

The start url could be any subsite url, that may not be a top level site.

Note: The script is written om SharePoint 2010 version, by changing the Get-SPWeb cmdlet to 2007 version ( like $site=new object Microsoft.Sharepoint.SPSite('ur'))  ,  it could work well.