Alexander’s Blog

May 18, 2013

Using PowerShell to Create a SharePoint Service Application Pool

by @ 8:59 pm. Filed under SharePoint, Tips & Tricks

There are situations where creating a service application pool in SharePoint Server 2013 using PowerShell comes handy. Well, you can also use the same command for SharePoint Server 2010. Here’s the command.

New-SPServiceApplicationPool -Name “SITPUG Search Service Application Pool” -Account SITPUG\SP_Search

Where “SITPUG Search Service Application Pool” is the name of the application pool that you want to create. I used quotes because there are spaces in the name. SITPUG is the name of the domain and SITPUG\SP_Search is the service account in the SITPUG domain that will be used by the application pool. The result will be something similar to this:

Name                                             ProcessAccountName
——-                                               ——————————–
SITPUG Search Service Application… SITPUG\SP_Search

PS C:\Windows\system32>

To view all the existing application pools you can use the following command.

Get-SPServiceApplicationPool | select Id, Name

You will notice that the left column lists the Ids and the right column lists the names. Here’s an example.

PS C:\Users\SP_Admin> Get-SPServiceApplicationPool | select Id, Name

Id                                                                                         Name
–                                                                                          -——–
4a3524ac-fc36-4b76-ab66-e8b4abca1cfc1      SITPUG Search Service Application Pool
447ba2a3-b5a3-5234-3c34-b47ef6ba5dc4     SecurityTokenServiceApplicationPool
cba42cbe-bb43-3525-8457-ae24846b90c4    SharePoint Web Services System

To delete the orphaned application pool type:

Remove-SPServiceApplicationPool -Identity “Name of Orphaned Application Pool”

What’s confusing here is that even though the command uses the switch called Identity, you don’t want to use the “Id”, you want to use the name of the application pool in the above command. For example, if the SeattlePro Search Service was the orphaned application pool that is available for you to use in SharePoint but you don’t see it in IIS 7, you will use the following command to delete it.

Remove-SPServiceApplicationPool -Identity “SeattlePro Search Service

This should get rid of the orphaned application pool and you can recreate the pool by using the old name if you want.

May 1, 2013

Microsoft’s Billion Dollar Products

by @ 1:24 pm. Filed under Dev, Microsoft Office, News, Office 365, SQL Server, SharePoint, Windows 2003, Windows 2008, Windows 2012, Windows 7, Windows 8, Windows XP

Microsoft has several products that are generating good revenue for their business. Mary Jo Foley recently published this article that has more details. Most of the heavy hitters are big names but SharePoint definitely stands out.

There are over dozens products in this select group that generate over a $1 billion a year in sales for Microsoft, including the following products listed in alphabetical order.

    1.  Azure
    2.  Developer Tools
    3.  Dynamics (ERP & CRM)
    4.  Office
    5.  Online display and search advertising.
    6.  SharePoint (crossed the $2 billion mark in 2012)
    7.  SQL Server
    8.  System Center
    9.  Unified Communications
    10. Windows
    11. Xbox

    SharePoint is supposedly the only product that have crossed the $2 billion mark. If I am not mistaken, SharePoint was also the first product to cross the $1 billion in sales. You can bet all the tea in China that Office365 will be added to this list shortly.

    For more information on this topic, check out Mary Jo Foley’s article. She also has some other interesting stuff in her article.

    April 27, 2013

    How to Use Active Directory to Prevent Unwanted SharePoint Installations in Your Organization

    by @ 8:32 am. Filed under Active Directory, SharePoint, Tips & Tricks

    As you may know, SharePoint deployments are managed at the farm level. Therefore, users can install additional SharePoint farms in your environment without your permission. Obviously, you don’t want SharePoint farms popping up on your network without your knowledge and approval. You want to make sure that new deployments conform to your company’s standards. So how do you stop unauthorized SharePoint deployments? Use the following methods to block or track SharePoint installations.

    How to Block SharePoint Installations

    To disable the installation of SharePoint Server and related products, configure the following registry key using Group Policy in Active Directory directory services:
    HKLM\Software\Policies\Microsoft\Shared Tools\Web Server Extensions\14.0\ SharePoint\DWORD DisableInstall

    Setting the DWORD value DisableInstall=00000001 will block the installation. Once you have configured this setting, when a user tries to install SharePoint Server, he/she will get the following error message:

    SharePoint installation is blocked in your organization. Please contact your network administrator for more details.

    How to Track SharePoint Installations

    You can also track SharePoint installations in your organization by using the Active Directory Domain Services (AD DS) marker. Here’s a description from Microsoft TechNet on how the AD DS marker works.

    “An Active Directory Domain Services (AD DS) Marker called Service Connection Point identifies the SharePoint 2010 Products servers in an organization. To use this marker, create a container in AD DS and set the permissions for the container before you install any SharePoint 2010 Products in the environment. Then, when you or another user in your domain runs the SharePoint Products Configuration Wizard as part of installing SharePoint Server 2010, this marker is set, and can be tracked by using AD DS. You must set this marker for each domain that you have in your organization if you want to track installations in all domains. This marker is removed from AD DS when the last server is removed from a farm. You can also set the marker by using Windows PowerShell. The marker contains the URL for the Application Discovery and Load Balancer Service (also known as the topology service application) for the server farm.

    You have to grant permission to write to this container to any user accounts or domain accounts that could run the SharePoint Products Configuration Wizard. If the account does not have permission to write to this container, the following warning will appear in the log file for the SharePoint Products Configuration Wizard:

    Failed to add the service connection point for this farm

    Unable to create a Service Connection Point in the current Active Directory domain. Verify that the SharePoint container exists in the current domain and that you have rights to write to it.”

    For more information on how to create the container in Active Directory and set the permissions using Active Directory Service Interfaces (ADSI) Edit, check out this article.

    April 8, 2013

    How to Configure Regional Settings in SharePoint Server 2010

    by @ 5:44 pm. Filed under Articles, SharePoint, Tips & Tricks

    SharePoint Server 2010 uses several regional settings, such as Locale, Sort order, Time zone, Calendar, Time format and Currency. Here’s a description of these settings.

    Locale: The Locale setting controls numbering, sorting, calendar, and date and time formatting for the Web site.

    Sort order: This option controls the sort order for lists and libraries.

    Time zone: The Time zone setting lets you select the time zone that is appropriate for your location, such as Eastern Time zone.

    Calendar: This option lets you select the type of calendar you want to use. For example, in United States we use the Gregorian calendar. In Japan you may use Japanese Emperor Era calendar.

    Work Week: You can define the work week for your calendar, such as Monday through Friday.

    Time Format: You can select from 12 Hour or 24 Hour format. For example, the military uses 24 Hour format.

    Currency: You can also set your currency settings, which are configured on the Create Column page when you are working with lists. Technically, Currency is not a regional setting but because it is tied with the regional settings it is often considered a regional setting. The default value of the currency depends on the locale that you specify in your regional settings.

    There are three places where you can configure the regional settings in SharePoint Server 2010. Let’s take a closer look at these settings.

    1. Web Application level (requires access to Central Administration).
    2. Site level (requires Site Administrator permissions).
    3. User level.

    Web Application Level

    1. Go to Central Administration -> Application Management -> Manage web applications.
    2. Select the Web application and then on the ribbon click General Settings and from the drop-down menu select General Settings again.
    3. Select the appropriate time zone for your Web sites and then click OK. These settings will apply to any new sites that you create within this Web application. Existing sites are not affected.

    Site Level

    You can override the Web application level regional settings with the site level settings. You need to be a site owner to perform this action.

    1. Go to the site for which you want to change the regional settings.
    2. Go to Site Actions -> Site Settings -> Site Administration -> Regional settings.

    3. Select the appropriate regional settings for your region, such as Locale, Sort order, Time zone, Calendar, Alternate Calendar, and Time format and then click OK.

    User Level

    If the Web application and site level regional settings are not appropriate for users at different locations, such as different time zones, they can set their own regional settings.

    1. Login to the SharePoint site with your user account.
    2. Click on the Open Menu in the upper right-hand side and select My Settings.

    3. Click My Regional Settings.

    4. Uncheck the box Follow web settings and then select the appropriate setting, such as Locale, Time zone, Calendar, Alternate Calendar, and Time format and then click OK.

    5. You should now notice your new regional settings applied to your content. For example, if you upload a file it will display your local time and not the time set at the site or Web application level.

    Copyright ©2013 Zubair Alexander. All rights reserved.

    November 11, 2012

    How to Find the Largest Files on Your Windows Computer

    by @ 12:16 pm. Filed under Articles, SQL Server, Scripting, SharePoint, Tips & Tricks, Tools/Utils, Windows 2008, Windows 2012, Windows 7, Windows 8

    When working with Windows computers, especially Windows servers, I often run into situations where the hard drive is running out of disk space. In fact, I have often seen drives literally have no available space on a SharePoint or SQL server. There are too many reasons why a drive can run out of space, or continue to run out of space even if you keep freeing more disk space. In this article I won’t be going into the details of the reasons why drives run out of space but I can tell you that trace logs, SharePoint_Config_log.ldf file on SharePoint 2010, and cache files in %windir%\winsxs\ManifestCache folder on the server and PST files, temporary files, and thumbnails, eating up the disk on the workstation are a few common reasons. I have also blogged about other reasons in the past. The purpose of this article is to show you how to find out the size of some of the largest files on your computer so you can take action and delete them if they are not needed.

    Not all large files are needed. If they are not needed then there is no sense in keeping them on your computer. Obviously, you can delete a lot of small junk files but The question is how to find out which are the largest files. A simple way to find out the size of the largest files is to write a PowerShell script. You can then pipe the results of the script to a file and look at them one by one. Here’s a sample script that will display in GB the 5 largest files on your server or workstation. You can change the number 5 at the end of the script to display more or fewer large files.

    @echo off
    Powershell -noexit “Get-PSdrive  | where { $_.Used -gt 0 } | foreach { Get-ChildItem $_.Root -recurse -force -ErrorAction SilentlyContinue | Select Name,DirectoryName, @{Label=’Size’;Expression={($_.Length/1GB).ToString(‘F04′)}} | Sort Size -descending | select -first 5}”

    1. Paste the above script in Notepad.
    2. Save the file as a batch file (File, Save As, change “Save as type” to All files, click Save). Give it a name like Top5largestFiles.bat. Make sure you use the .bat extension, otherwise it will not execute as batch file.
    3. Start the Command Prompt as an Administrator.
    4. Go to the folder where you saved the batch file.
    5. Type the name of the batch file (e.g. Top5largestFiles). It’s optional to type the .bat at the end of a batch file because the system automatically knows that it’s an executable file.
    6. Wait a while because the batch file needs to go through every file on your computer. The results will be displayed in GB.
    7. You can also pipe the results into a text file if for some reason you want to save the results as a reference for future use. For example, type
      5ToplargestFiles > largefiles.txt
      This will send the results into a text file called largestfiles.txt.
    8. Once you know which files are the largest files you can go through them and see if some of them can be deleted. Obviously, you have to have certain level of knowledge to understand which files are safe to delete.

    As an example, on a SQL Server 2008 R2 if you run out of disk space, you can delete the file that ends with _blobs.bin (e.g. a368b368b28d9265_blobs.bin) in the %windir%\winsxs\ManifestCache folder. According to Microsoft, this file is used by Windows Update mechanism and it is safe to delete this file. However, do not delete or mess with any other files in the WinSxS foder. Even if you delete all the files in the ManifestCache folder, they may appear later after a Windows Update or a reboot but will likely be not as large. Just keep an eye on these files and deleted them when necessary. Here a post from Joseph Conway on TechNet that describes in detail what the WinSxS folder is all about. Unfortunately, there is no known solution to this problem of Windows servers and workstations running out of disk space. Until Microsoft comes up with a solution, here’s a workaround.

    Here’s how you can delete files in the Windows\WinSxS\ManifestCache folder.

    1. Run the above batch file to find out the top 5 largest files.
    2. If the files in the ManifestCache folder are among the largest files then use the following commands.
    3. Run Command Prompt as an Administrator.
    4. Run the command “net stop trustedinstaller” without the quotes to stop the Windows Modules Installer service. If your OS is running this service then make sure you wait for it to stop, if it’s not running and you get the message “The Windows Modules Installer service is not started” then go to the next step.
    5. Type EXIT to get out of the PowerShell command and run the command “takeown /f %windir%\winsxs\ManifestCache\*” without the quotes at the Command Prompt to take the ownership of the folder. This step is necessary because you must take ownership of the folder before giving the Administrators proper permission.
    6. If you get an error it’s likely because you ignored the first part of the previous step and ran the command inside PowerShell (if your prompt starts with PS then you are in the PowerShell command). If you run the command in PowerShell you will get the message “ERROR: The system cannot find the path specified.”
    7. Run the command “Icacls %windir%\winsxs\ManifestCache\* /grant Administrators:f” without the quotes to grant Administrators Full Access permissions to the folder.
    8. The last step is to delete the files in the ManifestCache folder. Run the command “del /q %windir%\winsxs\ManifestCache\*” without the quotes.
    9. Restart the Windows Modules Installer service by typing “net start trustedinstaller” without the quotes.

    Scheduling Cleanup of ManifestCache folder

    The ManifestCache folder will continue to grow in the future but you can create a batch file to cleanup the content occasionally. I would recommend that you clean up the folder only if you need disk space because the cache files will improve performance. This solution is for people who are in desperate need of additional disk space. Here’ a batch file that I use on my SharePoint 2010 server and my SQL Server 2008 R2 server. I saved the content of this batch file in Notepad and named the file CleanManifestFolder.bat. I run this file at the elevated Command Prompt.

    @echo off
    cls
    net stop trustedinstaller
    takeown /f %windir%\winsxs\ManifestCache\*
    Icacls %windir%\winsxs\ManifestCache\* /grant Administrators:f
    del /q %windir%\winsxs\ManifestCache\*
    net start trustedinstaller

    You can also schedule to run this file with Task Scheduler if necessary.

    Disk Cleanup Tool

    At this point you may want to go through additional files and delete them if they are safer to delete. On some operating systems, such as Windows 7, you also have the option Disk Cleanup on the drive properties. However, this tool is designed to delete only certain types of files that are safe to delete, such as downloaded program files, temporary Internet files, setup log files, temporary files, thumbnails, etc. It won’t find other files that can be very large and often useless. I still encourage you to go through these and delete them. Especially, the temporary files and thumbnails. I noticed that on my PC, the thumbnails were 79MB but the temporary files were a whopping 13.7GB. Your mileage may vary but the results may surprise you.


    Copyright ©2012 Zubair Alexander. All rights reserved.

    Contact E-mail | Terms of Use | Privacy Policy

    Copyright © 2013 Zubair Alexander. All rights reserved.

    Internal Links

    Search Blog

    Categories

    Archives

    May 2013
    M T W T F S S
    « Apr    
     12345
    6789101112
    13141516171819
    20212223242526
    2728293031  

    RSS Feeds

    TechGalaxy Visitors

    25 queries. 1.007 seconds