Wednesday, December 14, 2011

Error: Help Cannot be displayed

Check permissions for the Web Application application pool account
Open the Microsoft SQL Server Management Studio. Navigate to the Database roles for the SharePoint AdminContent database: (local)\SharePointinstance –> Databases –> SharePoint_AdminContent_8a628b24 –> Security –> Roles –> Database Roles
Double click WSS_Content_Application_Pools. This will open the Database Role properties. On the left hand side, select Securables. Look for the following entries:
  • proc_EnumResourcesAtScope
  • proc_EnumResourceValuesForAllLangs
If these do not exist, perform the following steps to add them:
Click Search… –> Specific objects… –> OK –> Object Types –> select Stored procedures –> OK –> enter the above 2 entries: proc_EnumResourcesAtScope and proc_EnumResourceValuesForAllLangs –> Click Check Names and accept –> OK.


Now the stored procedures are added to the WSS_Content_Application_Pools Database role. Now we need to add the Execute permission for this database role.
To do this, select the 2 entries, and check Execute. After you are done, click OK.

Tuesday, November 29, 2011

Create a Standard Quota

$quotaTemplateName = "Standard Quota"
$MaxLevelMB = 10240
$WarnLevelMB = 9216
    $quotaTemplate = New-Object Microsoft.SharePoint.Administration.SPQuotaTemplate
    $quotaTemplate.Name = $quotaTemplateName
    $quotaTemplate.StorageMaximumLevel = ($MaxLevelMB*1024)*1024
    $quotaTemplate.StorageWarningLevel = ($WarnLevelMB*1024)*1024
    $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    $contentService.QuotaTemplates.Add($quotaTemplate)
    $contentService.Update()

AAM REDIRECT von HTTPs auf HTTP

$webapp = "webappname"
$https= "https://url.com"
$http= "http://url.com"



$zone = "Internet"
 New-SPAlternateURL $https -Zone $zone -WebApplication $webapp
New-SPAlternateURL $http -Zone $zone -internal -WebApplication $webapp

Saturday, November 19, 2011

Search Results only available for Admins / Search in a OneWayTrust Scenario

(http://support.microsoft.com/kb/2344518)
SP FARM and UserAccounts are in different Domains


Resolution:

$SearchServiceApp = Get-SPEnterpriseSearchServiceApplication
$SearchServiceApp.SetProperty(“ForceClaimACLs”, 1
)

Start a full crawl!! 

Thursday, November 17, 2011

PeoplePicker: There was an error in the callback

Working with an environment where the QA and development machines are in a Test domain, while the production farm and all the primary users are in another domain. There is a one way domain level trust where the test domain trusts the production domain. In SharePoint 2007, we ran SetAppPassword and PeoplePicker-SearchADForests and everything worked just fine. However, in SharePoint 2010, we ran the exact same commands, and we started getting the following error when searching for users…FAIL :
There was an error in the callback
Thinking that the HTTP response would have some clues as to the cause of the error, we started out with a netmon trace. Unfortunately, there are no extra details in the actual response. I would see a POST to Picker.aspx with the search string, but the only thing in the response is the error message. No HTML, only the error. SharePoint trace logs are not showing anything either. We cleared out the PeoplePicker-SearchADForests property, and the People Picker would find users from the QA domain, and it would find users that were already added to the site. The content database was an upgrade from SharePoint 2007, so there were already Production user accounts in the site collections.
I started doing some research, and everything I was finding with regards to the error message was related to the SetAppPassword command not being ran on all the boxes. When you run SetAppPassword, it creates the following registry value:
HKEY_Local_Machine\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\Secure
AppCredentialKey : REG_BINARY
AppCredentialKey is the information used to encrypt/decrypt the information you pass into PeoplePicker-SearchADForests. This information has to be the same across all the servers, so you have to run SetAppPassword on every machine in the farm using the same password. In our case, we exported the registry key, and used Beyond Compare to validate that the entry was identical on all the servers.
Knowing that the registry key was a core piece of this error message, we did the following :
  1. Updated our Hosts file on our client machine to point to a specific server
  2. Ran Process Monitor on the server
  3. Ran IISReset
  4. Reproduced the error
We then searched the log file for the Secure registry key and found a single entry with a status of “Access Denied”. Looking at the details revealed that the Application Pool account was trying to read the registry and didn’t have access. We then checked permissions on the key to confirm that the WSS_WPG group did not have any access. In SharePoint 2007, this group has read access by default. Since our app pool needs to read the registry key to get the value for decrypting the People Picker property, we granted WSS_WPG read access. Once this change was made, all was right in the world, and the People Picker was able to return users from both domains.
You won’t see this issue if you run all your app pools as the Database Access account [aka farm account], but that’s not really a good thing to do.
To set this up in SharePoint 2010, we came up with the following steps:
  • Contoso domain has a one way trust with TailSpinToys
  • SharePoint 2010 is installed on machines joined to Contoso and using least privilege configuration with Contoso service accounts.
  • The People Picker needs to return users from both Contoso and TailSpinToys
  1. Run SetAppPassword on EVERY machine in the farm. This will setup your AppCredentialKey for you.

    StsAdm.exe –o SetAppPassword –password MyPassword
  2. Run SetProperty for PeoplePicker-SearchADForests on ONE server in the farm. This information is stored in the configuration database, no need to run it more than once for each URL where you want the people picker

    StsAdm.exe –o SetProperty –pn PeoplePicker-SearchADForests –pv “domain:TailSpinToys,TailSpinToys\AccountName,AccountPassword” –url http://TeamSites
  3. Set permissions on the Secure registry key on EVERY machine in the farm, granting the local WSS_WPG read access
    1. Open Registry Editor
    2. Navigate to : HKEY_Local_Machine\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\Secure
    3. Right-click Secure, select Permissions
    4. Click Add
    5. Find the local WSS_WPG group
    6. Select Read access
    7. Click OK out of the dialogs

Wednesday, November 16, 2011

Kerberos Config for Reporting Services

PORTAL   Domain\AppPoolIntranet
REPORTING:  Domain\ServiceAccountReporting
SQL Service: Domain\ServiceAccountSQL


SETSPN Commands should be executed on a Domain Controller.

setspn -s HTTP/intranet.domain.lcl " Domain\AppPoolIntranet"
setspn -s HTTP/intranet " Domain\AppPoolIntranet"
setspn -s HTTP/reporting.domain.lcl "Domain\ServiceAccountReporting"
setspn -s HTTP/reporting "Domain\ServiceAccountReporting"

setspn -s MSSQLSVC/SQLServer.domain.lcl "Domain\ServiceAccountSQL"
setspn -s MSSQLSVC/SQLServer "Domain\ServiceAccountSQL"

setspn -L "Domain\AppPoolIntranet"
setspn -L  "Domain\ServiceAccountReporting"
setspn -L  "Domain\ServiceAccountSQL"

Monday, October 24, 2011

User Profile Service Initial Sync Problems

Failure retrieving application ID for User Profile Application Proxy
REBOOT TUT GUT (vom Server welcher die UPS Rolle hat)

The Execute method of job definition Microsoft.Office.Server.UserProfiles.UserProfileImportJob (ID 8fa89e28-86ce-4644-a599-48fbd9e72e0f) threw an exception. More information is included below. Generic failure


HKLM\SYSTEM\CurrentControlSet\Services\FIMSynchronizationService\Parameters
FARM ACCOUNT BERECHTIGEN
..:Restart Timer Service

und / oder
NETWORK SERVICE Account auf c:\program files\office server\14.0 berechtigen.

Thursday, October 20, 2011

Event ID 5215: The EXECUTE permission was denied on the object 'proc_GetProductVersions', database 'SharePoint_Config', schema 'dbo'.

In the database server, expand SharePoint Config database and naviage to Programmability/Stored Procedures/dbo.proc_GetProductVersions using SQL Server Management Studio.
Right click on the above stored procedure and select Properties.
On the popup screen, select Permissions on the left and click Search button.
On the new popup screen, click Search, select [WSS_Content_Application_Pools] database role and click OK.
Click OK again.
On the first popup screen, select the role, check Execute permission and click OK.

Monday, October 17, 2011

Url Problem: %2520 --> %20

Lösung 1: (einfacherer Weg)
Select a view with broken images in Thumbnails view mode
Choose Site Actions > Edit Page
From the library Web Part's Edit drop-down, choose Edit Web Part, Apply, and OK
When you Exit Edit Mode, the Thumbnails appear correctly
Repeat for each view with broken Thumbnails

Lösung 2: (mühsamer Weg)
Cloned the view "All Pictures" to a view called "Temp" and assigned Temp to be the default view.
Delete the "All Pictures" view
Clone the view "Temp" to "AllItems" assigning AllItems to be the default view.
Delete the view "Temp"
Set the title fo the AllItems view to be "All Pictures"
Aside from the view GUID everything appears to be identical, but with links functioning properly.

Thursday, October 13, 2011

Wednesday, October 12, 2011

Delete all Content Databases within a WebApplication

$webapp = http://webappname"

get-spcontentdatabase -WebApplication $webapp | ForEach-Object {remove-spcontentdatabase $_.name}

Thursday, October 6, 2011

PeoplePicker -> Multiple Domains

$domain_trust = "mycompany.local"
$pp_user_in_trusted_domain = "pp_username"
$pp_pass_in_trusted_domain = "pp_password"

$pp_password = "peoplepickerpassword"



$computer = Get-WmiObject -Class Win32_ComputerSystem
$domain_local = $computer.domain
stsadm.exe -o setapppassword -password $pp_password
stsadm -o setproperty -pn "peoplepicker-onlysearchwithinsitecollection" -propertyvalue No
$all_webapps = Get-SPWebApplication -IncludeCentralAdministration
foreach ($webapp in $all_webapps)
{
 stsadm -o setproperty -pn "peoplepicker-onlysearchwithinsitecollection" -propertyvalue No -url $webapp.url
 stsadm.exe -o setproperty -url $webapp.url -pn "peoplepicker-searchadforests" -pv "domain:$domain_local;domain:$domain_trust,$pp_user_in_trusted_domain@$domain_trust,$pp_pass_in_trusted_domain"
}

Tuesday, October 4, 2011

Upgrade all Content DBs (after SP or CU)

PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures

 Get-SPDatabase | ?{$_.NeedsUpgrade –eq $true} | Select Name
Get
-SPContentDatabase | ?{$_.NeedsUpgrade –eq $true} | Upgrade-SPContentDatabase

Monday, September 26, 2011

Detach Database

Get-SPContentDatabase -Webapplication http://intranet

***************************************************
....ERGEBNIS:
Id               : c994b208-3617-4423-9c77-ff562ad4
Name             : WSS_Content_Intranet
WebApplication   : SPWebApplication Name=intranet
Server           : DATABASESERVER
CurrentSiteCount : 1
***************************************************


$ID= c994b208-3617-4423-9c77-ff562ad4
Dismount-SPContentDatabase $ID


oder wenn nur eine ContentDB in der Webapp enthalten ist oder alle DBs entfernt werden sollen:

Get-SPContentDatabase -WebApplication http://sitename | Dismount-SPContentDatabase -WhatIf

Thursday, September 22, 2011

Create HostA Record Using PowerShell

$domain = "contoso.com"
$dns_server = "servername"
$HostA = "testentry"
$ipAddress = "10.10.10.10"

$dnsZone = $domain
$fqdn_dnsServer=$dns_Server+"."+$domain
$fqdn_HostA = $HostA+"."+$domain
$class = 1
$ttl = 3600
$dnsAType = [wmiclass]"\\$fqdn_dnsServer\root\MicrosoftDNS:MicrosoftDNS_AType"

$dnsAType.CreateInstanceFromPropertyData($fqdn_dnsServer
, $dnsZone, $fqdn_HostA, $class, $ttl, $IPAddress)

Health Analyzer: Missing server side dependencies.

[MissingWebPart] WebPart class [baf5274e-a800-8dc3-96d0-0003d9405663] is referenced [25] times in the database [SharePoint_AdminContent_bab358d6-0248-4b19-a354-c040dd311d81], but is not installed on the current farm. Please install any feature/solution which contains this web part. One or more web parts are referenced in the database [SharePoint_AdminContent_bab358d6-0248-4b19-a354-c040dd311d81], but are not installed on the current farm. Please install any feature or solution which contains these web parts.


Solution:
http://blogs.msdn.com/b/sharepointalps/archive/2012/03/16/sharepoint-health-analyzer-missing-server-side-dependencies.aspx
or:

Wednesday, September 21, 2011

Health Analyzer: InfoPath Forms Service Cannot be filled out....

$application_name = “Shared State Service Application”
$application_db = “Shared_StateService_DB”


New-SPStateServiceApplication -Name $application_name

New-SPStateServiceDatabase -Name $application_db -ServiceApplication $application_name

New-SPStateServiceApplicationProxy -Name $application_name -ServiceApplication $application_name –DefaultProxyGroup

WarmUp Script

Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue 
   foreach ($webApp in get-SPWebApplication) 
    {     
        foreach ($site in $webApp.Sites) 
        { 
            foreach ($web in get-SPWeb -site $site) 
            { 
                $request = [System.Net.WebRequest]::Create($web.URL) 
                $request.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials 
                $request.proxy = [System.Net.WebRequest]::DefaultWebProxy 
                $request.ContentType = "application/x-www-form-urlencoded" 
                $request.Method = "GET" 
        try{ 
                    $request.GetResponse().StatusCode 
            WRITE-HOST $request.GetResponse().StatusCode 
                } 
                catch [Net.WebException]{ 
                    $WebExceptionMessage = $_.Exception.Message 
                    WRITE-HOST "Folgender Fehler ist aufgetreten: " + $WebExceptionMessage 
                } 
            } 
        } 
    }

Backup Content DB

$backup_name= "Backup_Name"
$backup_dir = "\\fileserver\dir"
$url = "http://intranet"


backup-spsite $url -path $backup_dir\+$backup_name -force -UseSqlSnapsho -Verbose
oder
backup-spsite $url -path $backup_dir\+$backup_name -force


Backup-SPSite -Identity <Site collection name> -Path <backup file> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]

Backup Config DB

$dbname= "SharePoint_Config"
$dbserver = "DBServer\Instance"
$backup_dir = "\\fileserver\dir"

Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue 
Backup-SPConfigurationDatabase -Directory $backup_dir -DatabaseServer $dbserver -DatabaseName $dbname -Verbose

Install Solution

$solution_path="x:\path\file.wsp"
$solution_name= "SolutionName"
$url = "http://hostheader"
Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue 

Add-SPSolution -LiteralPath $solution_path
Install-SPSolution -Identity $solution_name -WebApplication $url
Install-SPSolution -Identity $solution_name -AllWebApplications -GACDeployment -CASPolicies

Update 2007 to 2010 (Database Attach Method)

Copy DBs to new SQL Server
Check Security

Before Attach Content DB
Test-spcontentdatabase -name $contentdbname -webapplication $webappname

Mount-spcontentdatabase -name  $contentdbname -webapplication $webappname
Upgrade-spcontentdatabase  -name $contentdbname -webapplication $webappname

Create SiteCollection

$Title = "My Site Title"

$webappurl = "http://hostheader"
$pri_owner = "domain\user1"
$sec_owner = "domain\user2"



New-SPSite $webappurl -OwnerAlias $pri_owner -SecondaryOwnerAlias $sec_owner -Name $title -Template "STS#0"

Create WebApplication

$webappname = "myAutomatedWebApp"
$username = "domain\user"
$password = "Pa$$word"
$hostheader = "hostheader"
$port = 80


$content_db_name = "WSS_Content_"+$hostheader
$AppPool = "AppPool" + $webappname
$url="http://"+$hostheader
co
$secpass = convertto-securestring $password -asplaintext -force
$cred = new-object -typeName System.Management.Automation.PsCredential -argumentlist $username,$secpass

new-spmanagedaccount -Credential $cred

new-spwebapplication -name $webappname -port $port -hostheader $hostheader -URL $url -ApplicationPool $AppPool -ApplicationPoolAccount (Get-SPManagedAccount $username) -DatabaseName $content_db_name

Configure RBS (with Microsoft RBS Provider)

Add-SPShellAdmin -UserName CONTOSO\SP_Admin -Database ( Get-SPContentDatabase "WSS_Content_Intranet_IT" )
$site = Get-SPSite http://intranet/it
$web = $site.rootweb
$list = $web.Lists["Computer Inventory"]
$i = 1
do {
#add item
$newitem = $list.items.Add()
$newitem["Title"] = "Client-" + $i.ToString().PadLeft(4, "0");
$newitem["Computer Name"] = "Client-" + $i.ToString().PadLeft(4, "0");
$newitem["Serial Number"] = $i.ToString().PadLeft(8,"0");
$newitem.Update()
$i++
}
while ($i -le 4000)
$web.dispose()
$site.dispose()

$site = Get-SPSite "http://intranet/IT"
$web = $site.rootweb
$list = $web.Lists["Computer Inventory"]
$i = 4001
do {
#add item
$newitem = $list.items.Add()
$newitem["Title"] = "Client-" + $i.ToString().PadLeft(4, "0");
$newitem["Computer Name"] = "Client-" + $i.ToString().PadLeft(4, "0");
$newitem["Serial Number"] = $i.ToString().PadLeft(8,"0");
$newitem.Update()
$i++
}
while ($i -le 9000)
$web.dispose()
$site.dispose()

use [WSS_Content_Intranet_IT]
if not exists (select * from sys.symmetric_keys where name = N'##MS_DatabaseMasterKey##')create master key encryption by password = N'Master Key Pa$$w0rd'
if not exists (select groupname from sysfilegroups where groupname=N'RBSFilestreamProvider')alter database [WSS_Content_Intranet_IT]
add filegroup RBSFilestreamProvider contains filestream
alter database [WSS_Content_Intranet_IT] add file (name = RBSFilestreamFile, filename = 'c:\Blobstore') to filegroup RBSFilestreamProvider
cd d:\labfiles\lab04
d:
msiexec /qn /lvx* rbs_install_log1.txt /i RBS_x64.msi TRUSTSERVERCERTIFICATE=true FILEGROUP=PRIMARY DBNAME="WSS_Content_Intranet_IT" DBINSTANCE="SP2010-WFE1" FILESTREAMFILEGROUP=RBSFilestreamProvider FILESTREAMSTORENAME=FilestreamProvider_1

$cdb = Get-SPContentDatabase "WSS_Content_Intranet_IT"
$rbss = $cdb.RemoteBlobStorageSettings
$rbss.Installed()
$rbss.Enable()
$rbss.SetActiveProviderName($rbss.GetProviderNames()[0])
$rbss

$cdb = Get-SPContentDatabase "WSS_Content_Intranet_IT"
$rbss = $cdb.RemoteBlobStorageSettings
$rbss.MinimumBlobStorageSize = 1048576
$cdb.update()

Visual Upgrade

$webappurl = "http://portal"
$webapp = get-spwebappllication $webappurl


Foreach ($s in $webapp.sites)
{$s.visualUpgradewebs() }

Change Site Collection Administrator

$webappurl = "http://portal"
$account1= "domainname\username"
$account2= "domainname\username"


$webapp = Get-SPWebApplication $webappurl
$allsites = $webapp | get-spsite -limit all


$allsites | foreach-object { Set-SPSite -owneralias $account1 -identity $_.url}
$allsites | foreach-object { Set-SPSite -secondaryowneralias $account2 -identity $_.url}

Start Healh Analyzer Manually

Get-SPTimerJob | Where {$_.Name -like "*Health*" -and $_.Name -like "*-all-*"} | Start-SPTimerJob