Tuesday, October 23, 2012

SQL Query: List all SQL Databases except System DB's


SELECT [name]
FROM master.dbo.sysdatabases
WHERE dbid > 4

Wednesday, October 3, 2012

Get Content DB Size of all Content DBs as "Report"

Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue 
$cdbs = get-spcontentdatabase
$sum = 0
Write-host "****************************************************" -foregroundcolor white
foreach ($cdb in $cdbs)
 {
 $size = [System.Math]::round(($cdb.DiskSizeRequired/1024/1024/1024),2)
 write-host $size "GB" "--->" $cdb.name   -foregroundcolor green
 $sum = $sum + $cdb.DiskSizeRequired
 }
Write-host "****************************************************" -foregroundcolor white
write-host "Total Space Used:" ($sum/1024/1024/1024/1024)"TB"  -foregroundcolor red
write-host "Total Space Used:" ($sum/1024/1024/1024)"GB"  -foregroundcolor red
Write-host "****************************************************" -foregroundcolor White

IIS ApplicationHost.config - Request Filtering (e.g. Filetype *.mdb)

If you want to allow a filetype like e.g. *.mdb it's not enough to allow that type within SharePoint.
You've to allow it as well within IIS (if request filtering is enabled)

That can be done manually




OR: if you've multiple IIS Servers within your SharePoint Farm via PowerShell Script:


$servers = "server1","server2","server3","server4"
foreach ($server in $servers)
 {
 

 Invoke-Command -computername $server -ScriptBlock {
 
        import-module webadministration
 
        Function Enable-IISFileExtension
        {
            PARAM(
                 $ConfigFile,
                 $FileType,
                 $Flag
        
                 )
            $xml = [XML](Get-Content -Path $ConfigFile -ErrorAction STOP)
            $item = $xml.configuration."system.webServer".security.requestFiltering.fileExtensions.add | Where-Object {$_.fileExtension -match "$FileType"}
            $item.allowed = $Flag
            $xml.Save($ConfigFile)
   
            return $xml.configuration."system.webServer".security.requestFiltering.fileExtensions.add | Where-Object {$_.fileExtension -match "$FileType"}
   
        }
        Enable-IISFileExtension -ConfigFile "C:\Windows\System32\inetsrv\config\applicationHost.config" -FileType ".mdb" -Flag "True"
 
 
  Exit-PSSession
  }
 } 



Tuesday, October 2, 2012

The site is not valid. The 'Pages' document library is missing.

ULS Log tells me that:
The site is not valid. The 'Pages' document library is missing. ......

Solution to this problem was really simple.
I've found a blogentry on blogs.technet.com, which tells me to update the "PAGES ID", and it worked well.


$web = get-spweb "http://site-collection/path-to-affected-site"
$correctId = $web.Lists["Pages"].ID
$web.AllProperties["__PagesListId"] = $correctId.ToString()
$web.Update()

$web.AllProperties["__PublishingFeatureActivated"] = "True"
$web.Update()

Thursday, August 2, 2012

What's new in SharePoint 2013 (SP15)

Dear all,
I've found a really exciting Site where some new SharePoint features gets introduced.

http://technet.microsoft.com/en-us/sharepoint/fp142374.aspx

At the following Link, you'll find some training modules for IT PROs
http://technet.microsoft.com/en-US/sharepoint/fp123606

As i'm configuring at the moment a LAB environment , I'm going to post some new Issues/Solutions very soon.


Wednesday, July 4, 2012

Event ID 8193 Volume Shadow Copy Service Error

Volume Shadow Copy Service error: Unexpected error calling routine RegOpenKeyExW(-2147483646,SYSTEM\CurrentControlSet\Services\VSS\Diag,...). hr = 0x80070005, Access is denied.
Context:
Writer Class Id: {0ff1ce14-0201-0000-0000-000000000000}
Writer Name: OSearch14 VSS Writer
Writer Instance ID: {07c936a8-347c-4e39-8014-2a057f611382}


Solution:
Go to the details tab within the event.
There you'll see some information AND a USER --> the SharePoint Search Admin Account.

Just give that user Full Control at the Registry Key:
HKLM\SYSTEM\CurrentControlSet\Services\VSS\Diag

After a Serverreboot the errormessage shouldn't appear again.

Tuesday, July 3, 2012

Event 2159 / 5586

Event 5586 (SharePoint Foundation) of severity 'Error' occurred 540 more time(s) and was suppressed in the event log.

Reasons for this Event:
http://technet.microsoft.com/en-us/library/cc561042(v=office.12).aspx


Possible Fix:
1.Open the SQL Server Configuration Manager (assuming you are using SQL 2008 or higher)
2.Browse down to SQL Server Network Configuration – Protocols for <namedserverinstance>
3.Right-click “Named Pipes” in the right pane and choose Enable
4.You may need to restart the server for changes to take effect


Granting the farm database access account “VIEW SERVER STATE” under the SQL Server properties will also resolve this issue.

use [master]
GO
GRANT VIEW SERVER STATE TO [domain\timer_service_user]
GO

Friday, June 22, 2012

Get Template Used by Site

$site_where_template_is_needed = get-spweb "http://rooturl/sites/sitename"

write-host $site_where_template_is_needed.webtemplate




Site Templates: get-spwebtemplate

Tuesday, June 19, 2012

UserProfileApplication.SynchronizeMIIS: Failed to configure ILM, will attempt during next rerun. Exception: System.Data.SqlClient.SqlException

RUN AS FARMADMIN!!!!!

$sync_db = "PROD_SA_UPS_Sync"
$ups_service_app_name = "User Profile Service"



net stop sptimerv4
$syncdb=Get-SPDatabase | where {$_.Name -eq $sync_db}
$syncdb.Unprovision()
$syncdb.Status='Offline'
$ups = Get-SPServiceApplication  | where {$_.Displayname -eq $ups_service_app_name }
$ups.ResetSynchronizationMachine()
$ups.ResetSynchronizationDatabase()
$syncdb.Provision()
net start sptimerv4

Start the UserProfileSyncService again

Monday, June 18, 2012

Stop all Incoming Mail Services

Get-SPServiceInstance | ? {$_.Typename -eq "Microsoft SharePoint Foundation Incoming E-Mail"} | Stop-SPServiceInstance -Confirm:$False

Monday, May 21, 2012

Delete Orphaned Databases

Example for all UPS Databases
Get-SPDatabase | Where{$_.Name -like "*ups*"} | ForEach {$_.Delete()}

Thursday, April 19, 2012

Start all Health Analyzer Jobs

get-sptimerjob | where {$_.Name -like "*Health*" -and $_.Name -like "*all*"} | start-sptimerjob

Monday, April 16, 2012

Rename Central Administration Content Database

$ca_webapp_name = "http://centraladmin_url:9090"

$new_ca_contentdbname = "Content_CentralAdministration"

$old_ca_contentdatabase = get-spcontentdatabase -webapplication $ca_webapp_name

new-spcontentdatabase -name $new_ca_contentdbname  -webapplication $ca_webapp_name


$new_ca_cdb_id = Get-SPContentDatabase -WebApplication $ca_webapp_name | where {$_.Name -eq $new_ca_contentdbname}



get-spsite -contentdatabase $old_ca_contentdatabase | move-spsite -destinationdatabase $new_ca_cdb_id

 .... i will test this solution at 19th. April 2012

Tuesday, April 10, 2012

Visual Upgrade

$site = Get-SPSite("SP2007 Look And Feel SiteCollection")
$site.VisualUpgradeWebs()

Monday, April 2, 2012

Silent SharePoint Server installation

Create a BAT file within your SharePoint Binary Path: %~dp0setup.exe /config %~dp0SPconfig.xml

Create a File: SPConfig.xml within your SharePoint Binary Path and copy the following text into it.


<Configuration>
 <Package Id="sts">
  <Setting Id="LAUNCHEDFROMSETUPSTS" Value="Yes"/>
 </Package>
 <Package Id="spswfe">
  <Setting Id="SETUPCALLED" Value="1"/>
         <Setting Id="REBOOT" Value="ReallySuppress"/>       
  <Setting Id="OFFICESERVERPREMIUM" Value="1" />
 </Package>
 <Logging Type="verbose" Path="C:\SharePoint\Log" Template="SharePoint Server Setup(*).log"/>
 <PIDKEY Value="12345-12345-12345-12345-12345" />
 <DATADIR Value="C:\SharePoint\Data"/>
 <Display Level="none" CompletionNotice="yes" />
 <Setting Id="SERVERROLE" Value="APPLICATION"/>
 <Setting Id="USINGUIINSTALLMODE" Value="0"/>
 <Setting Id="SETUP_REBOOT" Value="Never" />
 <Setting Id="SETUPTYPE" Value="CLEAN_INSTALL"/>
</Configuration>

PS Script to Download all PreRequisites Files

http://gallery.technet.microsoft.com/scriptcenter/bcf3332d-f726-4ac7-b01a-eeda4b7ece8e

Configure Incoming Mail

http://technet.microsoft.com/en-us/library/cc262947.aspx

Summary:

Thursday, March 29, 2012

Query Suggestions

$myquerysuggestion = "SharePoint"

$sa = Get-SPEnterpriseSearchServiceApplication
New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $sa -Language EN-US -Type QuerySuggestionAlwaysSuggest -Name $myquerysuggestion

Wednesday, March 28, 2012

Add a User and/or Group to all SiteCollections as SiteCollection Admin

This Script will automatically add a User and/Or Group to ALL SiteCollections in ALL WebApplications of your SharePoint Farm.
It can be very easily modified to do this action on just one WebApp  by editing the line
$wapps = Get-SPWebApplication to
$wapps = Get-SPWebApplication "mywebappname"