Saturday, November 30, 2013

Health Analyzer: The server farm account should not be used for other services

Problem

You connect to Central Administration and observe a critical issue:
You click the link, View these issues, displayed in the message bar, and you see the error, The server farm account should not be used for other services, appear in the SharePoint 2010 Health Analyzer Review problems and solutions report:
Solution
  1. Click the error link to view its description dialog:
  2. The error description dialog identifies the cause of the problem: the Web Analytics Data Processing Service is being run by the farm account.
  3. Close the dialog.
  4. In Central Administration, go: Security > General Security > Configure service accounts.  The Service Accounts page appears.
  5. From the dropdown, select Windows Service - Web Analytics Data Processing Service.
    .
  6. From the Select an account for this component dropdown, select a managed account other than the farm account.  For this posting, the sp_app account was selected:
  7. Navigate back to the Review problems and solutions page, and then click the error link, The server farm accounts should not be used for other services.
  8. On the error description dialog, look for the button Reanalyze Now:
    This launches the Health Analyzer
  9. Click this button.  After you click this button, it will become disabled.
  10. Click Close.  The error description dialog closes. Wait a minute or two for the Health Analyzer job to complete.
  11. Refresh the page: the error no longer appears:
Summary

This posting presented steps for resolving the health analyzer rule, The server farm account should not be used for other services. For additional details on this topic, consult the references below.

References
Notes
  • By default, the rule governing the Health Analyzer checking this condition runs weekly.  You can verify this yourself by going: Monitoring > Health Analyzer > Review rule definitions. Look in the Category: Security group.

Sunday, November 24, 2013

How to migrate a VHD to VMware Workstation

Introduction

This posting walks you through the process of migrating a pre-configured Microsoft Virtual Hard Disk (VHD) system to VMware, using nothing more complex than a text editor.  This posting integrates relevant postings on this topic from other authors.  Links to all references uses in researching and developing this posting are provided in the References section, below.  This posting was developed on VMware Workstation 7.1.3 build-324285, but applies to other VMware products, including ESX and Player.

In this posting, you will migrate the Microsoft Windows Server 2003 R2 Enterprise Edition VHD to VMware Workstation 7.1.3.

Step 1: Prepare VHD
  1. Download or locate the Source VHD. For this posting, the source VHD filename is Win2k3R2EE.vhd.
  2. Create a new folder in your VMware VM directory.  For this posting, a new folder win2k301 was created.
  3. Copy the source VHD to your VMware directory
    While not absolutely necessary, it facilitates file management to keep the VHD source file co-located in the same folder as the target VMware VM folder.
Step 2: Create New VM
  1. Launch VMware Workstation.
  2. From the File menu, point to New and then point to Virtual Machine..
  3. Click Virtual Machine.  The first page of the New Virtual Machine Wizard appears.
  4. Select the Custom (advanced) option
  5. Click Next.
  6. On the Choose the Virtual machine Hardware Compatibility page, select the appropriate virtual machine hardware compatibility from the Hardware dropdown, and then click Next.
  7. On the Guest Operating System Installation page, select the I will install the operating system later option, and then click Next.
  8. On the Select a Guest Operating System page, from the Guest operating system group, select Microsoft Windows, and then click Next.
  9. On the Processor Configuration page, leave all settings default, and then click Next.
  10. On the memory for the Virtual Machine page, change the memory to 1 GB (1024 MD), and then click Next.
  11. On the Network Type page, choose the network configuration desired.  For this posting, the Use bridged networking option was selected
  12. Click Next.
  13. On the Select I/O Controller Types page, leave the default (LSI Logic), and then click Next.  The next page is the most important in the VM creation process.
  14. On the Select a Disk page, select Use an existing virtual disk.
  15. Click Next.  The Select an Existing Disk page appears
  16. On the Select an Existing Disk page, click Browse, and then navigate to the location of the VHD
  17. Select the VHD file, and then click Open.  The navigation dialog closes, and you are returned to the Select an Existing Disk page
  18. Back on the Select an Existing Disk page, verify that the path and file name are correct, and then click Next.
  19. On the Ready to Create Virtual Machine page, click Finish.  The VM is created and a new tab appears in VMware
  20. Verify that the VM folder now has VMSD, VMX and VMXF files
Step 3: Edit VMX File
  1. Exit VMware Workstation.  If you are using ESX, remove the new VM (but don't delete the files).
  2. Navigate to the VM folder created in Step 1.  This folder should contain the VHD file along with a VMSD, VMX and VMXF files
  3. Right-click the VMX file, in this posting named win2k301.vmx, point to Open With, and then choose Notepad.  The VMware VM settings file opens in NotePad.
  4. Edit the scsi0.present setting from TRUE to FALSE.
  5. Edit the scsi0:0.present setting from TRUE to FALSE.
  6. Add the following settings:
    ide1:1.present = "TRUE" ide1:1.deviceType = "disk" ide1:1.fileName = "Win2k3R2EE.vhd"
  7. Save and close the VMX file.
Step 4: Launch the VM
  1. Launch VMware Workstation.  If you are using ESX, add the VM back.
  2. Start the VM.
  3. If you repeatedly experience this blue screen,
    you may not have correctly edited the VMX settings file.  Review this file and try again.
  4. You'll see the usual Windows settings screen appear
    and then various Windows Setup dialogs will also appear; and the rest is normal Windows startup
  5. If, after logging into the Windows VM, you find the cursor missing or stuck in the bottom right corner, see Troubleshooting I below.
  6. If after trying to shutdown Windows VM, you find that it appears to hang, see Troubleshooting II below.
Summary

This posting has presented one method for migrating Microsoft VHD systems to VMware Workstation without the need for third party conversion tools.  The process merely involves minor changes to the VMware settings file for the VM.

Troubleshooting I: Mouse cursor does not appear within the virtual machine window
This can occur if the original VHD system had Microsoft Virtual Machine Additions installed.  To verify this, perform the following tests:
  1. Right-click anywhere in the virtual machine window: does a pop-up appear repeatedly in the bottom right corner no matter where you right-click?
  2. Using your keyboard navigation skills, check the installed software: is Virtual Machine Additions listed?
If either is the case, try the following:
  1. Re-open the VHD in Virtual PC or Hyper-V, remove the Virtual Machine Additions, and then repeat steps 1-4 above.
  2. Re-install or update the VMware tools, but leave out the mouse driver, and then reboot.
  3. Launch Regedit, navigate to
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\... ...Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}
    look for the UpperFilters setting, and remove msvmmouf and any spaces from its value, leaving the mouclass value still there
Troubleshooting II: Shutdown Locks
This occurs after attempting a normal shutdown of the server.  The screen changes, the message appears indicating that server is shutting down, the message disappears, and then only a normal desktop is displayed that is unresponsive to keyboard and mouse input.  The only way to force the server to shutdown us using VMware shutdown option.  There is significant discussion and troubleshooting steps on this issue to be found in the VMware knowledgebase.  However, the workaround is simple:
  1. On the VM server (guest OS), from the Start menu, point to Control Panel, and then point to VMware Tools.
  2. Click this item.  The VMware Tools dialog appears
  3. Select the Scripts tab:
    1. On the Scripts tab, from the Script Event dropdown, select Shut Down Guest Operating System.
    2. Enable Use Script.
    3. Select Custom script
    4. Click the Edit button.
    5. In that file, add the following:  shutdown /s /t 10 /d P:0:0 /c "VM guest shutdown".
  4. Save and close the file
  5. Click OK.
  6. Test by performing a normal shutdown of the server.
References
Notes

Saturday, November 9, 2013

SharePoint: Error occurred in deployment step Add Solution

Problem

You attempt to deploy a new Visual Studio 2010 solution to SharePoint 2010.  After you click Deploy, you see the following error appear in the Error list:
Error 3 Error occurred in deployment step 'Add Solution': The solution does not have a WSP file associated with it [your feature or solution name]
You attempt to deploy the solution again, but again experience the same error.  There appears to be no issue with your solution.

Solution

Perform an IISRESET /noforce

References
 

SharePoint 2010: How to Customize Application Pages

Introduction

This posting walks you through the process of customizing the AccessDenied application page using Visual Studio 2010, step-by-step.  The AccessDenied application appears when a user attempts to access a resource for which he or she does not have the necessary permissions:
The approach used to customize this application page can also be used to modify the other customizable application pages, including:
  • Confirmation.aspx
  • Error.aspx
  • Login.aspx
  • ReqAcc.aspx
  • SignOut.aspx
  • WebDeleted.aspx
The approach detailed her involves using Visual Studio 2010 to create and deploy a new feature.  Note that you can also accomplish modifying these pages using PowerShell.  You would need to first create the application page, modify it as desired, and then use PowerShell to set the webApp.UpdateMappedPage property.  More on this approach is provided in the References below.

Step 1: Create a new SharePoint 2010 project
  1. Launch Visual Studio 2010
  2. On the Start page, click New Project. The New Project dialog appears.
  3. On the tree panel, at left, select Visual C#, the SharePoint, and then 2010.
  4. On the list pane, at center, select Empty SharePoint Project.
  5. In the Name field, below, enter a name.  For this project, the name will be CustomErrorPageFeature2:
  6. Click OK. The SharePoint Customization Wizard dialog appears.
  7. Enter the URL to the web application to which you want to deploy the new feature.
  8. Select Deploy as a farm solution.
  9. Click Finish.  The Visual Studio 2010 desktop appears.
Step 2: Configure the project
  1. In Solution Explorer, at right, right-click on the project name, point to Add, and then point to SharePoint Layouts Mapped Folder:
  2. Click this selection. A Layouts folder and CustomErrorPageFeature2 subfolder are added to the project.
    The Layouts folder points to the virtual _layouts folder physically located here:
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS
    
  3. In Solution Explorer, right-click on the project name, point to Add, and then point to SharePoint Images Mapped Folder.   The Images folder points to the virtual images folder that is physically located here: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES
  4. Click this selection.  An Images folder and CustomErrorPageFeature2 subfolder are added to the project. The project now presents two mapped folders, each pointing to physical folders in SharePoint:
  5. In Solution Explorer, right-click on Layouts/CustomErrorPageFeature2 subfolder, point to Add, and then point to New Item.
  6. Click this item.  The Add New Item dialog appears.
  7. On the left tree panel, select Visual C#, SharePoint, and 2010.
  8. On the center list panel, select Application Page.
  9. In the Name field, enter a name for the application page.  For this posting, the feature will be named CustomAccessDenied.aspx.
  10. Click Add.  The new application page is added and the page is opened in design view.
  11. Right-click on Layouts/CustomErrorPageFeature2 subfolder again, point to Add, and then point to Existing Item.
  12. Navigate to: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS, and then select AccessDenied.
  13. Click Add.
  14. Now, right-click on the Images/CustomErrorPageFeature2 subfolder, point to Add, and then point to Existing Item.
  15. Navigate to your image, and then select your image.
  16. Click Add.
  17. The project should now include two application pages in the Layouts folder and an image in the Images folder:
Step 3: Prepare CustomAccessDenied.aspx
  1. If it is not already open, double-click on CustomAccessDenied.aspx.
  2. Select everything in this file (CTRL+A), and then remove it (CTRL+X).
  3. If it is not already open, double-click on AccessDenied.aspx.  It will appear in Design view.
  4. Select everything in this file (CTRL+A), and then copy (CTRL+C).
  5. Go to CustomAccessDenied.aspx.
  6. Paste into this file (CTRL+V).
  7. In Solution Explorer, select AccessDenied.aspx.
  8. Press the DEL key, and click OK at the warning prompt.
  9. Save the project.
Step 4: Edit CustomAccessDenied.aspx
  1. Go to CustomAccessDenied.aspx and review its markup.  Look for the place holder tag, PlaceHolderPageTitleInTitleArea.  The Text property of this control determines what appears for the application title:
  2. For this place holder, edit the Text property by removing the in-line ASP code, and replacing with your desired text.  For this posting, the text will be replaced with: Oops! You don't have the appropriate permissions to access this resource!
  3. Look for the PlaceHolderPageTitle tag, and edit its Text property by replacing the in-line script with your desired text.  The Text property of this control determines what appears in the browser tab or title for this page:
  4. For this posting, edit the text to replace it with: Oops! Access Denied!
  5. Next, add the following script tag, editing the image file name to whatever you appropriate to your image:
    <asp:Content ID="Content6" ContentPlaceHolderId="PlaceHolderIcon" runat="server">
       <img   title="pgclogo" border="0" alt="PGC Logo" src="/_layouts/images/CustomErrorPageFeature2/Bee_Spring_2010.jpg"  height="41" width="50" />
    </asp:Content>
    
    This control determines the image that is displayed on the page:
Step 5: Develop Feature Code
  1. In Solution Explorer, look for the Features folder.  Right-click this folder, and then point to Add Feature.
  2. Click this item.  The Feature1.feature tab appears:
  3. In Solution Explorer, look for the new feature you added.  It will appear in the Features folder.  By default it is named Feature1.  Right-click this item, and then point to Add Event Receiver.
  4. Click this item.  A new tab code view will appear, Feature1.EventReceiver.cs:
  5. In this code view, look for the FeatureActivated and FeatureDeactivating methods.  This will be commented out by default.
  6. Uncomment both of these methods.
  7. Add a using directive for the SharePoint.Administration namespace:
    using Microsoft.SharePoint.Administration
    
  8. Add the following code within the FeatureActivated method:
    using (SPSite site = new SPSite("http://spdev12"))
    {
     //Get a reference to the web application.
     SPWebApplication webApp = site.WebApplication;
     //Update AccessDenied application page to AxsDnd.aspx.
     webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, 
        "/_layouts/CustomErrorPageFeature2/CustomAccessDenied.aspx");
     webApp.Update();
    }
    
  9. Add the following code within the FeatureDeactivating method:
    using (SPSite site = new SPSite("http://spdev12"))
    {
     //Get a reference to the web application.
     SPWebApplication webApp = site.WebApplication;
     //Reset the mapping to the default application page.
     webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, null);
     webApp.Update();
    }
    
  10. Next, update URL in the SPSite method to point to your site.  For this posting, the URL is updated to http://spdev12:
Step 6: Build Project
  1. In Solution Explorer, right-click the project name, and then point to Build.
  2. Click this item.  After a few moments, the build process is completed, and any warnings and errors encountered during this process are listed in the Error panel.  You can ignore the warning associated with the PlaceHolderIcon control.
Step 7: Deploy feature
  1. In Solution Explorer, right-click the project name, and then point to Deploy.
  2. Verify that the deploy process was completed successfully, by viewing the Output list.
  3. Open a browser, and then connect to Central Administration.
  4. In Central Administration, go: System Settings > Farm Management > Manage Farm Solutions.
  5. Verify that your new farm solution appears listed.
  6. Click on the farm solution, and then verify that it was already deployed.
Step 8: Test
  1. Open a browser, and then connect to a page in the web application that only a site owner or administrator should be able to access, such as, for example, the Site Collection Administrators page.
  2. From the user menu, in the top right corner of the page, point to Sign in as Different User.
  3. Click this item.
  4. At the prompt, enter authentication details for a test account that does not have owner permissions.
  5. Click OK. The new Access Denied application page should now appear:
  6. Verify that the browser and page titles are as configured, and that the new page icon is also the one configured.
  7. Leaving this page as it is, for the moment.  Do not close this browser page or navigate away from it.
  8. From a new browser tab or browser instance, connect to Central Administration.
  9. In Central Administration, go: System Settings > Farm Management > Manage Farm Solutions.
  10. Click on the your solution listed.  The Solution Properties page is displayed.
  11. Click Retract Solution.  The Retract Solution page is displayed.
  12. Leave all settings default, and then click OK.  You are navigated back to the Solution Management page. Refresh the page, to observe the status of the retraction process.
  13. After a minute of two, the status will be updated to indicate that the retraction process has been completed.
  14. Go back to the browser page still displaying the new access denied application page.
  15. Press the CTRL key, while also pressing F5.  The page will be refreshed, and the default access denied page should then appear.
  16. This completes this posting.
Summary

This posting has presented the necessary steps for customizing the SharePoint Server 2010 customizable application pages using Visual Studio 2010.  The approach used in this posting was to deploy the customization as a feature to the SharePoint instance.  All references used in developing this posting are listed below.  You can also implement custom application pages through PowerShell methods, which are discussed in the references cited below.

References