Pages

Tuesday, July 2, 2013

Getting User Mailbox size with location in Exchange 2007 using script

I was involved to deploy Exchange Hybrid for office 365 project and find the below powershell script to Getting Existing users mailbox size with location while gathering exchange 2007 information.

Run the below script on Exchange 2007 server
$exchangeservers = Get-MailboxServer
$AllUsers = @()
$AllUsersEmail = @()
foreach ($server in $exchangeservers)
{
$AllUsers += Get-Mailbox -Server $server |Get-MailboxStatistics |select servername,displayname,itemcount,totalitemsize
}
foreach ($user in $AllUsers)
{
 $obj = new-object psObject
 $mailinfo = get-mailbox -identity $user.displayname |select PrimarySMTPAddress,Office, DistinguishedName
 $tmp = [adsi]("LDAP://" +  $mailinfo.DistinguishedName)

 $obj |Add-Member -MemberType noteproperty -Name "Server Name" -Value $user.ServerName
 $obj |Add-Member -MemberType noteproperty -Name "Display Name" -Value $user.DisplayName
 $obj |Add-Member -MemberType noteproperty -Name "Item Count" -Value $user.ItemCount
 $obj |Add-Member -MemberType noteproperty -Name "Total Item Size" -Value $user.TotalItemSize.value.toMB()
 $obj |Add-Member -MemberType noteproperty -Name "Email Address" -Value $mailinfo.PrimarySMTPAddress
 $obj |Add-Member -MemberType noteproperty -Name "Office" -Value $mailinfo.Office
 $obj |Add-Member -MemberType noteproperty -Name "Description" -Value $tmp.description
 $AllUsersEmail += $obj
}
$AllUsersEmail |Export-Csv c:\test.csv -NoTypeInformation

Create Sharepoint 2013 Search Service Application Topology using Script

I have created Search Service Application Topology for sharepoint 2013 using below powershell Script


# Create a new Search Service Application in SharePoint 2013

 Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
# Settings

$IndexLocation = "E:\Sharepoint 2013Index” #Location must be empty, will be deleted during the process!

$SearchAppPoolName = "SearchServiceApplicationPool"

$SearchAppPoolAccountName = "ramu\spsearchapp”

$SearchServerName = (Get-ChildItem env:computername).value

$SearchServiceName = "Search Service Application"

$SearchServiceProxyName = "Search Service Application Proxy"

$DatabaseName = "Search Service AdminDB"

Write-Host -ForegroundColor Yellow "Checking if Search Application Pool exists"

$SPAppPool = Get-SPServiceApplicationPool -Identity $SearchAppPoolName -ErrorAction SilentlyContinue

if (!$SPAppPool)
{

    Write-Host -ForegroundColor Green "Creating Search Application Pool"

    $spAppPool = New-SPServiceApplicationPool -Name $SearchAppPoolName -Account $SearchAppPoolAccountName -Verbose

}

# Start Services search service instance

Write-host "Start Search Service instances...."

Start-SPEnterpriseSearchServiceInstance $SearchServerName -ErrorAction SilentlyContinue

Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $SearchServerName -ErrorAction SilentlyContinue
 

Write-Host -ForegroundColor Yellow "Checking if Search Service Application exists"

$ServiceApplication = Get-SPEnterpriseSearchServiceApplication -Identity $SearchServiceName -ErrorAction SilentlyContinue

if (!$ServiceApplication)

{

    Write-Host -ForegroundColor Green "Creating Search Service Application"

    $ServiceApplication = New-SPEnterpriseSearchServiceApplication -Partitioned -Name $SearchServiceName -ApplicationPool $spAppPool.Name -DatabaseName $DatabaseName

}

 
Write-Host -ForegroundColor Yellow "Checking if Search Service Application Proxy exists"

$Proxy = Get-SPEnterpriseSearchServiceApplicationProxy -Identity $SearchServiceProxyName -ErrorAction SilentlyContinue


if (!$Proxy)

{

    Write-Host -ForegroundColor Green "Creating Search Service Application Proxy"

    New-SPEnterpriseSearchServiceApplicationProxy -Partitioned -Name $SearchServiceProxyName -SearchApplication $ServiceApplication

}


$ServiceApplication.ActiveTopology

Write-Host $ServiceApplication.ActiveTopology

# Clone the default Topology (which is empty) and create a new one and then activate it

Write-Host "Configuring Search Component Topology...."

$clone = $ServiceApplication.ActiveTopology.Clone()

$SSI = Get-SPEnterpriseSearchServiceInstance -local

New-SPEnterpriseSearchAdminComponent –SearchTopology $clone -SearchServiceInstance $SSI

New-SPEnterpriseSearchContentProcessingComponent –SearchTopology $clone -SearchServiceInstance $SSI

New-SPEnterpriseSearchAnalyticsProcessingComponent –SearchTopology $clone -SearchServiceInstance $SSI

New-SPEnterpriseSearchCrawlComponent –SearchTopology $clone -SearchServiceInstance $SSI

Remove-Item -Recurse -Force -LiteralPath $IndexLocation -ErrorAction SilentlyContinue

mkdir -Path $IndexLocation -Force

New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $SSI -RootDirectory $IndexLocation

New-SPEnterpriseSearchQueryProcessingComponent –SearchTopology $clone -SearchServiceInstance $SSI

$clone.Activate()

Write-host "Your search service application $SearchServiceName is now ready"

Remove SharePoint Admin Database Guid/ Rename SharePoint admin Database


Remove SharePoint Admin Database Guid/ Rename SharePoint admin Database

PowerShell commands for removing Guid for SharePoint admin content DB

## Step1 Create New SharePoint content Database for SharePoint central admin site

New-SPContentDatabase -Name <New Database Name> -webapplication <web application URL>

## Get SharePoint database ID’s for central admin site which is old and new DB’s

Get-spwebapplication -identity <Web application URL> |Get-spcontentdatabase       

## Move central admin site to from old Database to new SharePoint content database using Database ID

Get-spsite -contentdatabase <Source Database ID> | Move-spsite -DestinationDatabase <Destination Database ID>

###Click A to confirm for moving the site from old database to new database

#### Remove OLD SharePoint admin content database using Old database ID

Remove-SPContentDatabase -identity <OLD Database ID>

Monday, July 1, 2013

sharepoint 2013 installation


Hardware and Software requirement for SharePoint 2013:

                                                                                                           Please find the below link for Hardware and software requirement for install SharePoint 2013 servers.


 

 

SharePoint Service Account for Best practice for SharePoint 2013

                                                                                Please refer the below link for Service account setup for best practice in SharePoint


 

SharePoint 2013 Prerequisites:

                         We have installed required prerequisite listed software’s using SharePoint

 Prerequisites setup files.


SharePoint 2013 Installation:

Once the prerequisite has been installed, click the SharePoint 2013 server installation to start the Actual SharePoint server installation.

The following EULA screen appears. Read the EULA and check the “I accept the terms of this agreement” if you do and then click the “Continue” button.


The next screen is regarding the type of setup required. Select “Complete” and click the “Install Now” button.


The next screen is regarding the target location of the software installation. Click the “Install Now” button.


On clicking the “Install Now” button, the software installation process begins. Wait for the installation to complete and on the last screen, Check the “Run SharePoint Configuration Wizard” checkbox and click the “Close” button.


On the SharePoint Configuration Wizard welcome screen click “Next” button to continue.


Since this is the first server in the farm, select the “Create a new server farm” option and click the “Next” button


In the next screen, enter the details as shown below and click the “Next” button


Since this is a new farm, a passphrase is required to be entered. This passphrase will enable joining of other servers to this newly created farm.

On the next screen, specify the port number on which the SharePoint 2013 Central Administration Web Application will run and Set the Authentication type as “NTLM” and Click Next to continue


The next screen is a confirmation screen. Review the settings and click “Next” to begin the SharePoint configuration.


On clicking “Next” the Configuration Wizard starts and applies relevant settings to the SharePoint installation. When the configuration has completed, the below screen is shown.


 

User does not have permission to perform this action in SharePoint


I was trying to configure search service application in SharePoint 2013 and I got the below error message
“Errors were encountered during the configuration of the Search Service Application.
System.Data.Sqlclient.SqlException (0x80131904): User does not have permission to perform this action. at
System.Data.SqlClient.Sqlconnection.On Error(Sql Exception exception. Boolean breakconnection, Actio&1
wrapcloselnAction) at System.Data.Sqlclient.TdsParser.ThrowExceptionAndWarning(TdsParserstateobject stateObj.
Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClientTdsParser.TryRun(Runßehavior
runßehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,
TdsParserStateObject stateObj. Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader
(SqlDataReader ds, Runßehavior runßehavior, String resetOptionsString) at
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(Commandßehavior cmdBehavior, Runßehavior
runßehavior, Boolean returnStream, Boolean async. 1nt32 timeout, Task& task Boolean asyncWrite) at
System.Data.SqlClient.SqlCom mand.RunExecuteReader(Com mand Behavior cmd Behavior, Run Behavior run Behavior,
Boolean returnStream, String method, TaskCompletionSource’1 completion, 1nt32 timeout Task& task, Boolean
asyncWrite) at System.Data.SqlClient.Sqlcommand.InternalExecuteNonQuery(TaskCom pletionSourc&1 completion.
String methodName, Boolean sendToPipe. 1nt32 timeout Boolean asyncWrite) at
System.Data.SqlClient.SqlCommand.ExecuteNonQueryO at”

Resolution:

                        For fixing the permission issue

 

1.       First we make sure that SharePoint farm account in the SharePoint farm admin groups.

2.       Second make sure that SharePoint farm account in the WSS_WPG groups

3.       Make sure SharePoint admin account in the SQL has the below roles

3a. DB creator

3b. SecurityAdmin

 

      For my case, I have found the SharePoint admin account not added in the SQL security admin role in SQL and once I added the SecurityAdmin role in SQL, I was able to create the Search Service application in SharePoint 2013