Tuesday, January 31, 2012

Sharepoint 2010 Application Pool GUID

Having problems finding out which application pool is for which service in Sharepoint 2010 all you get is the GUID.  Well Run the below Powershell script to obtain application Pool information.

Get-SPServiceApplicationPool | select Id, Name, ProcessAccountName |ft

It is displayed as below

<><>
IdNameProcessAccountName
508h3s656-hdrf-gs45-afse5-ffhgrrddgffg7567MetaDataServiceAppPoolDomain\service account name
fdfkh56-3454g-34ds-ffdkr-vclkjtj304954SecurityTokenServiceApplicationPoolDomain\service account name
xgt62r-1dr3-2345-sdf3-dfdgfrgfd454SharePoint Web Services SystemDomain\service account name
dfetbr65576-fgt64f-fr565-xdrgff3-dfrt56ntgrUserProfilePoolDomain\service account name

Sharepoint 2010 Best Bets Import

Is your Business Analyst, and business unit going mad over best bets slowly editing them to get ready for go-live, have hundreds to import into Sharepoint 2010, we used the below CSV layout and Powershell script to import Best Bets.  This will keep them happy for a while and get them off your back ;) I obtained this from this great post http://get-spscripts.com/2010/10/create-search-keywords-and-best-bets.html

CSV column layout below
Keyword,Definition,Synonyms,BestBet1,Description1,Url1,BestBet2,Description2,Url2,BestBet3,Description3,Url3

Powershell Script to import CSV file 
function Import-SearchKeywords ($SiteUrl, $CSVFilePath, [switch]$RemoveOldKeywords)
{
$ssap = Get-SPEnterpriseSearchServiceApplicationProxy -Identity “Search Service Application2″
$keywords = New-Object Microsoft.Office.Server.Search.Administration.Keywords($ssap, $SiteUrl)
$allKeywords = $keywords.AllKeywords
$date =
Get-Date
#Remove all previous keywords from the site collection if chosen


if($RemoveOldKeywords) {
$keywordsArray = @()
$allKeywords | ForEach-Object {
$keywordsArray = $keywordsArray + $_.Term
}
$keywordsArray | ForEach-Object {
write-host “Deleting keyword:”$_
$allKeywords[$_].Delete()
}
}
#Import CSV file
$csvData = Import-Csv $CSVFilePath | ForEach-Object {
#Create keyword
write-host “Importing keyword:”$_.Keyword
$keyword = $allKeywords.Create($_.Keyword, $date.AddHours(-1))
$keyword.Definition = $_.Definition
#Create synonyms
$synonymArray = @()
$synonymArray = $_.Synonyms.Split(“;”)
$synonymArray | ForEach-Object {
write-host “Creating synonym”$_ “for keyword” $keyword.Term
$keyword.Synonyms.Create($_)
}
#Create best bets
$bestBetColumnNumber = 1
$bestBetColumn = “BestBet” + $bestBetColumnNumber
$descriptionColumn = “Description” + $bestBetColumnNumber
$urlColumn = “Url” + $bestBetColumnNumber
while ($_.$bestBetColumn) {
write-host “Creating best bet”$_.$bestBetColumn “for keyword” $keyword.Term
$keyword.BestBets.Create($_.$bestBetColumn, $_.$descriptionColumn, $_.$urlColumn)
$bestBetColumnNumber = $bestBetColumnNumber + 1
$bestBetColumn = “BestBet” + $bestBetColumnNumber
$descriptionColumn = “Description” + $bestBetColumnNumber
$urlColumn = “Url” + $bestBetColumnNumber
}
#Update keyword with best bets
$keyword.Update()
}
}
Import-SearchKeywords –SiteUrl <enter site url> –CSVFilePath C:\BestBet.txt -RemoveOldKeywords

Need a list of All Sharepoint 2010 Database Names

Use the below script to list all the sharepoint 2010 Database names.  I used this to help me set up mirroring, as you will need a powershell script and the database name to set the database as a Mirror in Sharepoint 2010.


List Sharepoint Databases
Get-SPDatabase | Sort-Object disksizerequired -desc | Format-Table Name

Sharepoint 2010 Emails

Worried that lots of emails will be flooding out to all users when launched from the default emails settings in SharePoint 2010 Profiles.  Well don’t below is a script to turn off the default settings.  This is not our script but found on another site which we tested successfully.

Email Notifications:



The problems are that a new user to your organisation will still get all three options selected.  This can only be used on current profiles.

Change the value "Value = 110;"  to 1 or 0 for on or off


#Load the SharePoint snap-in
Add-PsSnapin Microsoft.SharePoint.PowerShell;
#Load the SharePoint assemblies
[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.Office.Server”);[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.Office.Server.UserProfiles”);if (($args -ne “Enable”) -and ($args -ne “Disable”)){
Write-Output “Unrecognized Argument: $args”;
exit;
}

#Specify the MySite URL
$MySiteUrl = “<MY Site URL>“;

#Get the server context for the profile manager
$site = Get-SPSite $MySiteUrl;
$ServerContext = Get-SPServiceContext $site;
$UPManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServerContext);

#Count variables
$ucount = 0;
$enumProfiles = $UPManager.GetEnumerator();
“Total User Profiles available:” + $UPManager.Count
$count=0;

#Loop through the profile entries and update the property
#SharePoint Notification emails – SPS-EmailOptin (int)
#This field has 3 values one for each email type

foreach ($oUser in $enumProfiles)
{
$count = $count + 1;
$u = $oUser.Item(“Accountname”);
if ($args -eq “Enable”){
Write-Output “($count): $args Setting values for $u”;
$oUser["SPS-EmailOptin"].Value = 000;
$oUser.Commit();
}
else{
Write-Output “($count): $args Setting values for $u”;
$oUser["SPS-EmailOptin"].Value = 110;
$oUser.Commit();
}
}
#Dispose of site object
$site.Dispose();

SharePoint 2010 - FIM Error removing a profile properties

We experienced an issue when removing incorrectly mapped user properties from user profiles.  The incorrectly mapped properties we added via code, and the code mapped a multi value user property to a single value Active Directory Property which is incorrect.  When we tried to remove this property and re-added correctly mapping single value to single value it would not let us add this in the UI.  After some investigation we found that it did not correctly remove from SharePoint FIM, which was stopping it from being added again.

The below error appears in windows application log

 "ERR: MMS(5888): iafparse.cpp(2731): IAF: the 'mv-attribute' attribute on element <import-flows> refers to non-existant MV attribute 'SPS_MV_String_<propertiy name>'
BAIL: MMS(5888): iafparse.cpp(2731): 0x8023050e (The import attribute flow rules XML defines an invalid/incomplete rule.)
BAIL: MMS(5888): iafparse.cpp(2188): 0x8023050e (The import attribute flow rules XML defines an invalid/incomplete rule.)
BAIL: MMS(5888): xstack.cpp(402): 0x8023050e (The import attribute flow rules XML defines an invalid/incomplete rule.)
BAIL: MMS(5888): xparse.cpp(428): 0x8023050e (The import attribute flow rules XML defines an invalid/incomplete rule.)
BAIL: MMS(5888): iafexec.cpp(146): 0x8023050e (The import attribute flow rules XML defines an invalid/incomplete rule.)
ERR: MMS(5888): mastate.cpp(12450): Error creating import attribute flow rules object: 0x8023050e
BAIL: MMS(5888): mastate.cpp(12538): 0x8023050e (The import attribute flow rules XML defines an invalid/incomplete rule.)
BAIL: MMS(5888): mastate.cpp(11237): 0x8023050e (The import attribute flow rules XML defines an invalid/incomplete rule.)
BAIL: MMS(5888): server.cpp(4068): 0x8023050e (The import attribute flow rules XML defines an invalid/incomplete rule.)
Forefront Identity Manager 4.0.2450.34"


To fix this problem you have to do:

1)    Remove the user property from Sharepoint as normal, removing it from the Central admin under “application management”, “manage service applications”, “user profile service application”, Click Manage user properties.
2)    Open miisclient.exe from "C:\Program Files\Microsoft Office Servers\14.0\Synchronization Service\UIShell\miisclient.exe"
a.     Go to management agent, click on MOSS-<GUID>
b.     Click on Attribute Flow and expand options until you find the user property you have an issue with and click delete.
c.     Click on Configure attributes and delete the same user property from this list.
d.      to management agent, click on MOSSAD-<domain>
e.     Click on Attribute Flow and expand options until you find the user property you have an issue with and click delete.
f.      Finally Click Metarverse Designer, click person, and remove the attribute from here as well.
3)    Perform a full synchronisation, and now you will be able to add the same named user property

Monday, January 30, 2012

SharePoint 2010 - Enable Wildcard Search

To enable wildcard search in SharePoint 2010 
1) Go to "Central Admin", Application Management", then "Manage Service Applications"
2) Click "Federated Locations" on the left hand nav bar.
3) Click "Local People Search Results", then expand location information.
4) Add a * to the end of Query Template and "More Results" link Template.

Friday, January 27, 2012

SharePoint Disable Loopback on server


This needs to be actioned to resolve 401 errors (access denied from Web Server and putting a logon failure in eventlog)




Setting the DisableLoopbackCheck registry entry in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa registry subkey to 1. 


To set the DisableLoopbackCheck registry entry to 1, follow these steps on the client computer: 


1. Click Start, click Run, type regedit, and then click OK.  
2. Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa 
3. Right-click Lsa, point to New, and then click DWORD Value.  
4. Type DisableLoopbackCheck, and then press ENTER.  
5. Right-click DisableLoopbackCheck, and then click Modify. 
6. In the Value data box, type 1, and then click OK.  
7. Exit Registry Editor. 
8. Restart the computer. 


Note You must restart the server for this change to take effect. 

Thursday, January 26, 2012

500 Service Unavailable - ISA 2006 and SharePoint 2007

Using SharePoint 2007 and ISA 2006 I came across an issue where external users of a site were recieivng the error "500 Service Unavailable" - even though the site was available and working. After some digging around I found the following resolved my issue 


I was required to switch off "verify normalisation" on ISA - it seems its an incompatibly between ISA 2006 and SharePoint 2007 










Wednesday, January 25, 2012

SharePoint 2007 - Central Admin stops working when installing search


On a couple of occasions when going through initial configuration of search- Central Admin stops working - cannot access.
Don't panic - What actually happened in my instances whilst  using Windows 2008 is that if you setup the Search service it writes an entry in its local host file. For example on myServerA we set up appserver to be index server, sharepoint adds following entry to host files


fy80::49e2:5150:a356:32ac%10 myServerA 


What sharepoint is actually doing is reading the Link-local IPv6 Address which is not quite right.


This just needs to be manually replaced in host file 
127.0.0.1 localhost myServerA 

SharePoint 2010 - Remove certain accounts from SP2010 Profile Import


You need to create import rule

I would like to create rule that removes all accounts that has an underscore in the name - these are temps and are not required in the import.

Go to the User Profile service application and click Synchronization Connections.
Click edit connection filters to create an exclusion filter.
  • Attribute: sAMAccountName
  • Operator: Contains
  • Filter: _ 

SharePoint 2010 - Key Points for Starting Profile Sync Service


Starting this service is an art within itself - I have done various installs and never got it right first time - here are the key points I have found either from experience or other consultants..
  1. Although it goes against security - when you start the service ensure the farm account is Local Admin and you login as this account to start the 2 services - User Profile Service and User Profile Sync Service - this will not work otherwise !!!
  2. If you find the User Profile Sync Service is just showing a continuous status of "Starting" - give it at least 30 mins - I have seen this on a Dev box - if this still shows - restart the server and ensure you login as the farm account (Point 1 above)
  3. Always double check the Group Policy and permissions in Active Directory - especially when you get a bit further and try and import users you need to add the  "Replication Directory Changes Permission" to the service account you are using to pull in users
The guide I always use to get this going is Spencer Harbars guide which is excellent - http://www.harbar.net/articles/sp2010ups.aspx


SharePoint 2010 - "There was an error saving the picture. Please try again later. "

Found this issue when editing user profiles of other people - resolved with the following CU
http://support.microsoft.com/kb/2597014

SharePoint 2010 - The specified value for the LocStringId parameter is outside the

Came across this error installing a new Farm after putting on SP1 -  Noticed the error when accessing "Manage Services on Server " 


My Resolution - Check Service Packs  - I had just installed SP1 and for some reason had not taken the SharePoint Server (office) patch properly to resolve took the following action and worked for me
  • Install SharePoint Foundation 2010 SP1
  • RESTART OS
  • Install SharePoint Server 2010 SP1
  • IISRESET
  • Run psconfig -cmd upgrade -inplace b2b -wait