SharePoint 2010
Powershell: Update all Document Libraries with MajorVersionLimit and MajorWithMinorVersionsLimit
by mysticslayer on Jun.15, 2011, under blog, Powershell, SharePoint 2010
I had to write a Powershell script to run thru all sites in a Web Application to enable Versioning. As well Major as Minor versions. With of course a limit on Major and Minor versions.
Next script should do the trick:
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
$siteURL = $args[0]
$site = Get-SPSite($siteURL)
foreach($web in $site.AllWebs) {
Write-Host "Inspecting " $web.Title
foreach ($list in $web.Lists) {
if($list.BaseType -eq "DocumentLibrary") {
Write-Host "Versioning enabled: " $list.EnableVersioning
$host.UI.WriteLine()
Write-Host "MinorVersioning Enabled: " $list.EnableMinorVersions
$host.UI.WriteLine()
Write-Host "EnableModeration: " $list.EnableModeration
$host.UI.WriteLine()
Write-Host "Major Versions: " $list.MajorVersionLimit
$host.UI.WriteLine()
Write-Host "Minor Versions: " $list.MajorWithMinorVersionsLimit
$host.UI.WriteLine()
$list.EnableVersioning = $true
$list.EnableMinorVersions = $true
$list.MajorVersionLimit = 2
$list.MajorWithMinorVersionsLimit = 5
$list.Update()
Write-Host $list.Title " is updated with MajorVersionLimit 2 and MajorwithMinorVersionsLimit = 5"
}
}
}
Kerberos, Reporting Services and SharePoint Integrated http 401: Unauthorized
by mysticslayer on Apr.06, 2011, under Active directory, Kerberos, Reporting Services, SharePoint 2010
When it comes to Reporting Services integrated with SharePoint it is difficult to solve problems when you don’t know where to start. Alot of people having issues when solving problems, or configuring Kerberos that way that Windows Integrated security is working properly.
At my work I’ve been at different customers, and still having some problems when it comes to Kerberos, why? Because every environment is different, every server is different, and when it comes to Reporting Services integrated with SharePoint it is some times a hell to fix issues.
So I’ve done multiple integrations with Reporting Services and SharePoint, and yet I know alot about Kerberos. Setting up delegations between App Pools and SSRS, SSRS and SSAS, SSAS and MSSQL, SSRS and MSSQL.
So I’ve ran last monday in a problem with SharePoint and Reporting Services, and why I did I ran into it? Simply, not every environment is configured properly when it comes to DNS, AD, etc.
So I’ve used Fiddler, DelegConfig v1, DelegConfig v2 Beta, ProcessMonitor, but yet I couldn’t figure it out. Even with HTTP streaming, etc I couldn’t see any information. The only thing I could see that was every time I tried I was succesfully logon.
Everytime I get with the integration was the following error: The request failed with HTTP status 401: Unauthorized
Probably everyone that has configured SSRS with SharePoint has seen this error in his life, right? Well If you hit google or bing for it, it will always show Reporting Services Add-In SharePoint. Yes, this is the one everyone is talking about.
Well I used all the tooling a SharePoint dude has to know. But yet I didn’t receive any request on the server running SSRS, and you know why? Because somebody forget to add the http://
SharePoint Timer Job deploying on Farm with wrong SPServer
by mysticslayer on Mar.24, 2011, under SharePoint 2010
It started all out with Reporting Services not running Workflows when Integrated, but yet I had still to do some workflow activities. So I thought of using a simple Timer Job that runs every hour or so to check if data has been changed. Well it worked out very well, but when deployed on a farm with multiple servers in it, I get a problem. It started to send e-mails… and not just one every time in the hour, but every content database it ran thru. (After I figured it out on the web by Robin of Sevenseas. Link
So I thought well allright, I should be using the SPJobLockType.Job with a Server specified. Well I did so. And as I did but with the wrong server name. Well it couldn’t be worse, it deployed the Timer Job successfully, and I started to debug. Didn’t notice the wrong server name though, but I set the server name into Title of the Timer Job, to check if the server is specified. Easy trick, easy done.
But what I see is that it added a totally wrong server name. Yes a server name not from the farm, it wasn’t even there in the domain. But still no error messages, and the timer job still runs like a charm. Yes you can fool the OWSTimer with wrong SPServer specified… because it doesn’t validate it.
SharePoint 2010 workflow problems BI Center.
by mysticslayer on Mar.09, 2011, under Reporting Services, SharePoint 2010, Visual Studio 2010
I’m working for a cliënt two days in a week, and he added a simple Subscription that creates a mhtml file into a document library. On that library is running a List Workflow that detect if there are any changes or new items added. If so, it should send emails to the stakeholders.
Well everything seems to be ok, and creating that kind of workflow with SPD shouldn’t be a problem, right? Well it’s going to be totally wrong.
When starting the workflow manual it’s fine, when adding a document by hand it’s also fine, but the problem starts when we’re adding mhtml files by subscription. So I thought that it had to do with the permissions. Well it weren’t exactly the permissions.
Here is an example of a manual added workflow by SPD. And what I am getting when subscription had run.
So I checked the ULS logs to find out which problems I’m having.
So I thought, well maybe I can run it with code. Just added some simple by using WorkFlowActivited and SPUtility. Well that didn’t do the trick. I’ve got even more errors. I even couldn’t debug my workflow.
And as you can see, it’s all run by ReportingServicesService.exe instead of SharePoint 2010. So we’re running in an NotYetSupportedException from Reporting Services instead of SharePoint 2010. Well there is some work to do for Microsoft.
Invalid features SharePoint 2010: Features due to a Failed, Missing, or Unsuccessful Activation SharePoint WSP
by mysticslayer on Oct.04, 2010, under features, Powershell, Programming, SharePoint 2010, SharePoint Foundation, Visual Studio 2010
Every developer has one of those days that everything goes wrong. You developed some feature, and you decided to change the namespace of the feature. For some reason or another SharePoint 2010 doesn’t handle this well, and even Visual Studio 2010 doesn’t know how to handle it. So you received a message that you allready activated a feature with the same Id you want to deploy? And you can’t revert it in someway?
Well I thought to use PowerShell to uninstall these spfeatures which I tried, but the message was cloud and clear, can’t uninstall feature, because feature isn’t found? Huh?? Why is that? Well I tried Get-SPFeature to retreive all the features I installed, and what did I see? My features standing in that list, so I tried to remove it by Id, and what happend? Can’t find feature by Id? Crap you would say? Well I used the WssAnalyzerTool from code.msdn.microsoft.com and managed to get all the failing features.
Then I tried to run the WssRemoveFeaturesTool from the same code.msdn.microsoft.com site, but what did you say? Even that tool couldn’t find that feature… Imagine that… So the last resort: yes the plain old fashioned stsadm. Did that work well, yes!! It worked more then you could think off.
stsadm -o disablefeature -Id
stsadm -o Uninstallfeature -id
So you think you can do everything with powershell, well sometimes you can, sometimes you can’t.
The mess of upgrading Solutions to SharePoint 2010
by mysticslayer on Oct.03, 2010, under Programming, SharePoint 2010, Software, Visual Studio 2010
The first of all is, when you go to a customer for a simple upgrade to SharePoint 2010 isn’t going to be easy. Why, well Rick Taylor is one of the masters of upgrading to SharePoint 2010, and now I know why he is preaching about all the mess you going to have with upgrading to SharePoint 2010.
A simple thought about upgrading isn’t going to be, why? Every customer has custom solutions, changed css’s or anything of that stuff, but it’s going to be worse. When you have Site Definitions, what is not the best practice of course it is going to be alot worse. All kinds of developers are writing and developing nice Site Definitions but when you are at the stage you want to upgrade these developers kan start all over again. Yes, because they put everything in a solution. Every complete customized lists, document libraries and blogs.
Wow, well if you are an architect or a business manager and you hear about Site Definitions and you’re upgrading to SharePoint 2010. You can think twice, and even need to save some money to hire a developer that can write all the site definitions again which are not best practice off course. Yes, why I am writing this blog, because I just started to upgrade some solution that is written if all the above mess. Customized blog pages, document libraries, lists, etc. Yes we make features and we make site definitions and we put them all in one bucket called a WSP and hopefully it will work under SharePoint 2010, because you’ll never know.
Claims to Windows Token Service (c2wts) problems
by mysticslayer on Aug.12, 2010, under .NET4.0, c2wts, Excel Services, SharePoint 2010, Windows Server 2008
Not alot of people had these issues regarding the Claims to Windows Token Service, but I had some problems with it. For some reason on Windows Server 2008 with Service Pack 2 and all prerequisites installed except voor KB971831-x64 HotFix voor WCF c2wts couldn’t be started. In the event viewer and in the ULS logs I had alot of messages that it takes too long to start te service.
Also when I browsed to the http://
For some reason or another it tries to make a connection to the outside world(internet) from the Service Application in order to get the ssl certificate, but this isn’t possible when you are at a production network of a cliënt. So I checked the config file of the SecurityToken.svc and I found out that there is a .NET framework 4.0 mentioned in it. So I downloaded the .NET Framework 4.0 and installed it on the production servers hosting SharePoint.
After installation it worked without any problems. I don’t know what fixes it, but it okay, because know we can use Excel Services as it should be.
Service principal names, kerberos, IIS 7.0 and error 401: The requested resource requires user authentication
by mysticslayer on Aug.07, 2010, under Internet Information Services, SharePoint 2010, Software, Windows Server 2008
The last couple of days I was working at a customer where Kerberos was needed for SharePoint 2010. Of course I started to set the different Service Principal Names for my App Pool accounts, farm accounts, machines, etc. Not to hard to do it, but I ran everytime in a 401 error: The requsted resources requires user authentication.
Strange I thought, but yet I sended the Domain Administrator more commando’s and it didn’t help. So I checked everything, checked for duplicates, etc. Still I ran into these errors.
After some search I found out that there are some problems with IIS 7.0 regarding Kerberos, and I needed to configure the applicationHost.config to solve these issues with Kerberos. enabled the kernel activation mode, etc. But, it didn’t make any difference, rebooted several times, removed the Kernel Activation Mode and removed again the changed on the applicationHost.config.
I knew that we’ve made C-Name records and it gave me a wonderfull idea to change the C-Name records to A records. These changes where applied, and wow, in less time as expected I opened IE and opened the different web apps. In less then a second the page was displayed from my web app. When you run in these problems, change your C-Name record to A-record and it will fix all your problems with SPN’s, Kerberos and IIS 7.0
User Profile Synchronization and the errors, a different approach.
by mysticslayer on Jul.26, 2010, under Active directory, ForeFront Identity Manager, SharePoint 2010, SharePoint Foundation, sql server, User Profile Services, Visual Studio 2010
When I started to work with SharePoint 2010 I’ve noticed that there are alot of issues regarding the User Profile Synchronization. Alot of people mentioned the following event viewer problems:
Microsoft.ResourceManagement.ServiceHealthSource
Event ID: 22
Level: ErrorThe Forefront Identity Manager Service cannot connect to the SQL Database Server.
The SQL Server could not be contacted. The connection failure may be due to a network failure, firewall configuration error, or other connection issue. Additionally, the SQL Server connection information could be configured incorrectly.
Verify that the SQL Server is reachable from the Forefront Identity Manager Service computer. Ensure that SQL Server is running, that the network connection is active, and that the firewall is configured properly. Last, verify the connection information has been configured properly. This configuration is stored in the Windows Registry.
ILM Web Service Configuration
Event ID: 234
Level: WarningILM Certificate could not be created: netsh http error:netsh http add urlacl url=http://+:5726/ user=MSSDEVIA\MSSFARM sddl=D:(A;;GA;;;S-1-5-21-3647457175-3930976156-3381717532-1106)
ForeFront Identity Manager
Event ID: 3
Level: Error.Net SqlClient Data Provider: System.Data.SqlClient.SqlException: Cannot open database “User Profile Service Application_SyncDB_1d4b979635654411b18ce834c5c0a76a” requested by the login. The login failed.
Login failed for user ‘MSSDEVIA\mssfarm’.
at Microsoft.ResourceManagement.Data.Exception.DataAccessExceptionManager.ThrowException(SqlException innerException)
at Microsoft.ResourceManagement.Data.DatabaseConnection.Open(SqlConnection connection)
at Microsoft.ResourceManagement.Data.DatabaseConnection.Open(DataStore store)
at Microsoft.ResourceManagement.Data.TransactionAndConnectionScope..ctor(Boolean createTransaction, IsolationLevel isolationLevel, DataStore dataStore)
at Microsoft.ResourceManagement.Data.TransactionAndConnectionScope..ctor(Boolean createTransaction)
at Microsoft.ResourceManagement.Data.DataAccess.RegisterService(String hostName)
at Microsoft.ResourceManagement.Workflow.Hosting.HostActivator.RegisterService(String hostName)
at Microsoft.ResourceManagement.Workflow.Hosting.HostActivator.Initialize()
at Microsoft.ResourceManagement.WebServices.ResourceManagementServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at Microsoft.ResourceManagement.WindowsHostService.OnStart(String[] args)
ForeFront Identity Manager
Event ID: 3
Level: Error.Net SqlClient Data Provider: System.Data.SqlClient.SqlException: HostId is not registered
at Microsoft.ResourceManagement.Data.Exception.DataAccessExceptionManager.ThrowException(SqlException innerException)
at Microsoft.ResourceManagement.Data.DataAccess.RetrieveWorkflowDataForHostActivator(Int16 hostId, Int16 pingIntervalSecs, Int32 activeHostedWorkflowDefinitionsSequenceNumber, Int16 workflowControlMessagesMaxPerMinute, Int16 requestRecoveryMaxPerMinute, Int16 requestCleanupMaxPerMinute, Boolean runRequestRecoveryScan, Boolean& doPolicyApplicationDispatch, ReadOnlyCollection`1& activeHostedWorkflowDefinitions, ReadOnlyCollection`1& workflowControlMessages, List`1& requestsToRedispatch)
at Microsoft.ResourceManagement.Workflow.Hosting.HostActivator.RetrieveWorkflowDataForHostActivator()
at Microsoft.ResourceManagement.Workflow.Hosting.HostActivator.ActivateHosts(Object source, ElapsedEventArgs e)
Of course I’ve watched the different blog posts from different MVP’s and others. But there still seems to be alot of different issues regarding the UPS of SharePoint 2010. Yet, I’ve found out that there are more issues as they speak of.
In my case the scenario was alot different then rights on the local machine or on the domain. The users had all the rights to perform Replicate Directory Changes on the domain, and yet I’ve had these errors.
I’d Visual Studio 2010 installed and it came up with the Jit-In-Time debugger with errors.
An unhandled exception (‘System.ServiceModel.ProtocolException’) occurred in OWSTIMER.exe [5630]
Application Error
Event ID: 1000
Level: ErrorFaulting Application name: OWSTIMER.exe, version: 14.0.4762.1000, time stamp: 0x4bad920c
Faulting module name: KERNELBASE.dll, version: 6.1.7600.16385, time stamp: 04xa5bdfe0
Exception code: 0xe0434f4d
Fault offset: 0x000000000aa7d
Faulting Process id: 0xa58
Faulting application start time: 0x01cb2cacfed18e83
Faulting application path: C:\Program Files\Common Files\Microsoft shared\Web Server Extensions\14\Bin\OWSTIMER.exe
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report id: f3b92d5f-98a3-11df-b4fd-000c29240fea
So, I’ve opened a new instance of Visual Studio 2010 Debugger, and it came up that the internal Proxy Server needed authentication. I did get a 407: Proxy Authentication Required.
If you think you’ve done everything to the different blog posts you’ve writtend, and you can’t find any issues, it can be that something else blocking your way to use the different SharePoint Application Services.
MS is not helping you with these kind of issues, but when you need some help, try to use Visual Studio on your application server, or server that is going to host the UPS service to identify which errors it comes up with.
If you can’t use Visual Studio because it’s a production environment, try to get a test environment in the same environment your production environment is in, and install there Visual Studio.