Tuesday, March 17, 2009
SharePoint and PowerShell
Here are some resources that I found online. They have great examples and show how to install and use PowerShell:
Windows Powershell Overview
http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx
Windows Powershell Scripting Resources
http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
Windows Powershell Download Page
http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx
All PowerShell articles by Karine Bosch
http://www.u2u.info/Blogs/karine/Lists/Categories/Category.aspx?Name=PowerShell
SharePoint PowerShell for Beginners by Karine Bosch
http://www.u2u.info/Blogs/karine/Lists/Posts/Post.aspx?ID=9
Bill Baer's PowerShell page
http://blogs.technet.com/wbaer/archive/2007/08/17/scripting-sharepoint-with-powershell.aspx
More Power"Shell" to you!
Monday, March 2, 2009
SharePoint site inaccessible after installing WSS 3.0 and MOSS 2007 Infrastructure Updates
At this point, the SharePoint Portal site was inaccessible. The Central Admin site was still accessible, but not the "user-facing" Portal site.
The SharePoint ULS log contained these errors:
02/27/2009 19:37:11 6 INF Resource retrieved id PostSetupConfigurationFailedEventLog is Configuration of SharePoint Products and Technologies failed. Configuration must be performed in order for this product to operate properly. To diagnose the problem, review the extended error information located at {0}, fix the problem, and run this configuration wizard again.
02/27/2009 19:37:11 6 ERR Configuration of SharePoint Products and Technologies failed. Configuration must be performed in order for this product to operate properly. To diagnose the problem, review the extended error information located at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS\PSCDiagnostics_2_27_2009_19_9_39_988_1181254095.log, fix the problem, and run this configuration wizard again.
02/27/2009 19:37:11 6 INF Resource retrieved id PostSetupConfigurationFailedUserMessage is Configuration of SharePoint Products and Technologies failed. Configuration must be performed before you use SharePoint Products and Technologies. For further details, see the diagnostic log located at {0} and the application event log.
02/27/2009 19:37:11 6 INF Sending a task driver stop event: TaskDriverEventArgs.EventCriticalityType error, TaskDriverEventArgs.EventType.stop, Configuration of SharePoint Products and Technologies failed. Configuration must be performed before you use SharePoint Products and Technologies. For further details, see the diagnostic log located at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS\PSCDiagnostics_2_27_2009_19_9_39_988_1181254095.log and the application event log.
The Applciation Event Log reported these errors:
Error 1
Failed to upgrade SharePoint Products and Technologies.
Failed to upgrade SharePoint Products and Technologies. Further information regarding this failure can be found at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS\Upgrade.log.
An exception of type Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException was thrown. Additional exception information: Failed to upgrade SharePoint Products and Technologies.
Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException: Exception of type 'Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException' was thrown.
at Microsoft.SharePoint.PostSetupConfiguration.UpgradeTask.Run()
at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()
Error 2
Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: (807)
Event ID: 5617
Date: 2/27/2009
Time: 7:58:51 PM
User: N/A
Computer: xxxxxxx
Description:
The schema version (3.1.3.0) of the database WSS_Portal on
Error 2 in the Application Event Log gave me a fighting chance to fix this issue. I learned that I need to run the following stsadm command to upgrade the database schema version. So I ran the following command on the SharePoint Server:
stsadm –o upgrade –inplace –url http://your_site_url_here
This took a few minutes and then reported that the upgrade completed successfully.
I then re-ran the "SharePoint Products and Technologies Configuration Wizard" and this time it completed successfully...no errors. And I was able to access our Portal site again.
This particular stsadm upgrade command is a life-saver.
Be sure to include this awesome command in your SharePoint Survivor toolkit.
Sunday, February 15, 2009
To Dispose or Not To Dispose is the Question
Answer - Do not call the Dispose() method on SPWeb, if you obtain the SharePoint SPWeb using the GetContextWeb method as shown below. If you call Dispose() on the SPWeb object obtained this way, it may cause the SharePoint object model to behave unpredictably or fail. This is due to an internal list that is kept in the SPSite and SPWeb objects derived in this way. Internally, the object model enumerates over this list after page completion to dispose of the objects properly.
web = SPControl.GetContextWeb(Context)
Here is a link to a best practices article titled "Best Practices: Using Disposable Windows SharePoint Services Objects"
http://msdn.microsoft.com/en-us/library/aa973248.aspx
Microsoft has a tool called, SPDisposeCheck, that will evaluate compiled assemblies and identify improper usage of SharePoint objects (such as SPWeb and SPSite) in your code. These objects, if improperly used, will cause memory leaks.
Here are links relevant to SPDisposeCheck:
http://code.msdn.microsoft.com/SPDisposeCheck
http://blogs.msdn.com/sharepoint/archive/2009/01/29/spdisposecheck-released.aspx
Thursday, January 22, 2009
Bug in .NET FileUpload control
Exception information: Exception type: SqlException Exception message: SQLServerAgent Error: Request to run job (from User ) refused because the job already has a pending request from User .
I found out that the SQL Job was being called twice and therefore causing the above error. I then added lots of debugging statements in my code and found that "Click" event was firing two times. And I did not have any looping constructs in my code. As a result my file was being uploaded TWICE, and the SQL Job was also being called TWICE. Uploading the file twice was not an issue in my case, as the goal was to overwrite if the file exists already. But calling the SQL Job twice was an issue.
Turns out that you DON'T NEED to specify the OnClick event in the button code like this. Having the OnClick event in the button code will cause the event to fire twice.
<asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" />
To prevent the Click event from firing twice, DO NOT specify the OnClick event. The updated code is shown below. This will cause the Click event to fire once.
<asp:Button ID="btnUpload" runat="server" Text="Upload" />
Happy Uploading!
Friday, December 19, 2008
HOW TO Resolve Recurring 6482 SharePoint Server 2007 Search Related Errors
Detailed info on this 6482 error is shown below:
Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server Shared Services
Event ID: 6482
Date: 11/6/2008
Time: 3:46:06 PM
User: N/A
Computer: xxxxxxx
Description:
Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance (db3c5f85-a70c-4901-98ed-a3e9a9030493).
Reason: Object bfc3dba7-666c-4968-9f4e-3c426d85c6b4 not found.
Techinal Support Details:
System.Collections.Generic.KeyNotFoundException: Object bfc3dba7-666c-4968-9f4e-3c426d85c6b4 not found.
at Microsoft.Office.Server.Search.Administration.SearchApi.get_App()
at Microsoft.Office.Server.Search.Administration.SearchApi.SetUsersPermittedToQuery(String[] userNames, Boolean force)
at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.Synchronize()
at Microsoft.Office.Server.Administration.ApplicationServerJob.ProvisionLocalSharedServiceInstances(Boolean isAdministrationServiceJob)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Complete the steps below to resolve the recurring 6482 error
1. Access the SharePoint Central Administration site.
2. Click on the “Operations” tab.
3. Click on “Services on Server” under “Topology and Services” section.
4. Stop the “Office SharePoint Server Search” and “Windows SharePoint Services Search” Services. Stopping these will uninstall the services, and once you re-start them and re-configure with the same settings, site content will start indexing properly again. You should not see the 6482 Errors anymore.
The KeyNotFoundException error reported in the Event Viewer message above was related to the following Object:
Object bfc3dba7-666c-4968-9f4e-3c426d85c6b4 not found.
This is actually a Registry key which is usually found under the following hives in the Registry on the SharePoint server:
HKLM\SOFTWARE\Microsoft\Office Server\12.0\Search\Applications\
HKLM\SOFTWARE\Microsoft\Office Server\12.0\Search\Setup\ContentIndexCommon\LanguageResources\Override\
You DON’T have to manually delete the “offending” Object from the above hives in the Registry. Stopping the 2 services in Central Administration site will remove the “offending” Object from the Registry.
NOTE: If you need to modify the Registry, REMEMBER TO CREATE A FULL BACKUP BEFORE MAKING ANY UPDATES.
Related Resources on the Web
http://www.eggheadcafe.com/software/aspnet/30014783/moss-2007-errors--still.aspx
http://social.technet.microsoft.com/forums/en-US/sharepointsearch/thread/81872231-0218-440f-b96f-2f5b02dd949f/
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.windowsservices&tid=69c450d4-97a2-412c-978a-94919e41c224&cat=&lang=en&cr=US&sloc=&p=1
http://blogs.pointbridge.com/Blogs/bragdon_dwight/Pages/Post.aspx?_ID=16
HOW TO Resolve recurring SharePoint Server 6398, 7076, 6482 errors in Event Viewer
net stop "Office SharePoint Server Search"
net start "Office SharePoint Server Search"
net stop "Windows SharePoint Services Timer"
net start "Windows SharePoint Services Timer"
From time to time you will see these errors occur in the Event Viewer on the SharePoint server. And when they do occur they occur very frequently (2-4 minutes apart) and they occur in groups. MOSS 2007 SP1 supposedly resolves this issue, but we applied SP1 on our SharePoint Server and these errors still occur intermittently. And when they do occur, it causes a blood bath in the Event Viewer.
Error details are shown below:
6398 Error
Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: Timer
Event ID: 6398
Date: 11/26/2008
Time: 7:59:14 AM
User: N/A
Computer: xxxxxxxxx
Description:
The Execute method of job definition Microsoft.Office.Server.Administration.ApplicationServerAdministrationServiceJob (ID a7450998-ba3e-4dc1-8528-1f1f851c41bf) threw an exception. More information is included below.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
7076 Error
Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server Shared Services
Event ID: 7076
Date: 11/26/2008
Time: 7:59:14 AM
User: N/A
Computer: xxxxxxxxxx
Description:
An exception occurred while executing the Application Server Administration job.
Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Techinal Support Details:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.DirectoryServices.Interop.UnsafeNativeMethods.IntADsOpenObject(String path, String userName, String password, Int32 flags, Guid& iid, Object& ppObject)
at System.DirectoryServices.Interop.UnsafeNativeMethods.ADsOpenObject(String path, String userName, String password, Int32 flags, Guid& iid, Object& ppObject)
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaClassName)
at Microsoft.SharePoint.Metabase.MetabaseObjectCollection`1.Find(String name)
at Microsoft.SharePoint.Metabase.MetabaseObjectCollection`1.get_Item(String name)
at Microsoft.SharePoint.Administration.SPProvisioningAssistant.ProvisionIisApplicationPool(String name, ApplicationPoolIdentityType identityType, String userName, SecureString password, TimeSpan idleTimeout, TimeSpan periodicRestartTime)
at Microsoft.SharePoint.Administration.SPMetabaseManager.ProvisionIisApplicationPool(String name, Int32 identityType, String userName, SecureString password, TimeSpan idleTimeout, TimeSpan periodicRestartTime)
at Microsoft.Office.Server.Administration.SharedWebServiceInstance.CreateSharedWebServiceApplicationPool(SharedResourceProvider srp)
at Microsoft.Office.Server.Administration.ApplicationServerJob.ProvisionLocalSharedServiceInstances(Boolean isAdministrationServiceJob)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
6482 Error
Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server Shared Services
Event ID: 6482
Date: 11/26/2008
Time: 7:59:14 AM
User: N/A
Computer: xxxxxxxxx
Description:
Application Server Administration job failed for service instance Microsoft.Office.Excel.Server.ExcelServerSharedWebServiceInstance (3db28ccf-4536-48d1-a04a-17ff31d6df9f).
Reason: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Techinal Support Details:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.DirectoryServices.Interop.UnsafeNativeMethods.IntADsOpenObject(String path, String userName, String password, Int32 flags, Guid& iid, Object& ppObject)
at System.DirectoryServices.Interop.UnsafeNativeMethods.ADsOpenObject(String path, String userName, String password, Int32 flags, Guid& iid, Object& ppObject)
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaClassName)
at Microsoft.SharePoint.Metabase.MetabaseObjectCollection`1.Find(String name)
at Microsoft.SharePoint.Metabase.MetabaseObjectCollection`1.get_Item(String name)
at Microsoft.SharePoint.Administration.SPProvisioningAssistant.ProvisionIisApplicationPool(String name, ApplicationPoolIdentityType identityType, String userName, SecureString password, TimeSpan idleTimeout, TimeSpan periodicRestartTime)
at Microsoft.SharePoint.Administration.SPMetabaseManager.ProvisionIisApplicationPool(String name, Int32 identityType, String userName, SecureString password, TimeSpan idleTimeout, TimeSpan periodicRestartTime)
at Microsoft.Office.Server.Administration.SharedWebServiceInstance.Synchronize()
at Microsoft.Office.Excel.Server.ExcelServerSharedWebServiceInstance.Synchronize()
at Microsoft.Office.Server.Administration.ApplicationServerJob.ProvisionLocalSharedServiceInstances(Boolean isAdministrationServiceJob)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Extract Date portion only from SQL DateTime
SELECT CONVERT(varchar, getdate(), 101)
Also, check out Jeff Smith's excellent blog here regarding SQL user-defined functions related to SQL DateTime data type.