Monday, 17 September 2012

NetBiosDomainNamesEnabled and SharePoint User Profile Service Application

NetBiosDomainNamesEnabled  property is set for every UPA (User Profile Service Application). By default this property is set false. We need to enable NetBios Domain Names for UPA when Domain Fully Qualified Domain Name (FQDN/DNS) is different then NetBIOS name.

Now the question araises how do we check whether the DNS and NetBIOS names.

Open Active Directory Users and Computers, right click and choose Properties.
you will see the below properties.

1 is your DNS/FQDN and 2 is your NetBios Domain Name.

If you dont have access to your domain Active Directory you can get the information using PowerShell command.

To find FQDN

To find NetBIOS name
Get-ADDomain -Identity "YourFQDN"
Now if you find that DNSRoot and NetBIOSName properties are not same then before synchronizing your UPA enable the NetBiosDomainNamesEnabled.
Below is the PowerShell command to enable the import of NetBios Domain Names.
(lists the Service Applications and their GUIDs)
$UPA = Get-SPServiceApplication –Id <GUID of User Profile Service Application>

Then start the UPA synchronizartion.

Hope this help!!
Isha Jain

Friday, 14 September 2012

User Profile Synchonization Service Stuck on Starting

Starting User Profile Synchonization Service in SharePoint is always a big pain. Most of the time it stuck on Starting mode and you dont have controll to stop this.

You can stop the User profile Synchronization Service.

There are many reasons for this.

1. The account which you are using to run the service might not have "Replicate Directory Changes" permission in your AD.


2. This account which you are using to run the service  might not have explicit access to the folder C:\Program Files\Microsoft Office Servers\14.0.

The reason we need to give explicit access to the folder is User Profile Synchronization service access AD through ForeFront Identity Manager Synchronization Service.

Thus in order to start User Profile Synchronization Service, Microsoft Forefront Identity Manager Synchronization Service have full access and this Forefront Synchronization service sits at C:\Program Files\Microsoft Office Servers\14.0.\Synchronization Service\UIShell called as miisclient (Microsoft ForeFront Identity Manager).

Solution: Give access

3.The password for the account which you are using to run the service is not correct.

Solution: Enter proper password or if the password is expired reset the password in AD and then  following the below link

Hope this help.

Thursday, 13 September 2012

Fix for SharePoint Search 2010 not able to connect to machine that hosts the admin component.

I faced a ugly error today on my central admin says Search Service not able to connect to the machine that host the administration component.

I read many blogs and mostly said create a new Search Service Application. I tried that but still the problem exists.

Below are the steps I followed to solve the issue of Serch Service Application.

1. Deleted the existing Search Service Application.
a. Get-SPServiceApplication
This will help to get the Search Service Application GUID.Copy the Search Service Application GUID
b. stsadm -o deleteconfigurationobject -id <GUID> from step a.

2. Delete the Application Pool for Search Service Application

a. Get-SPServiceApplicationPool
This will lists all the Service Application Pool. Find the one associated with Search Service Application
b.Remove-SPServiceApplicationPool <ApplicationPoolName>

3.Delete the CrawlStoreDB, PopertyStoreDB and AdminDB from the SQL Server responsible for holding all information related to Search Service Application.

Above three steps are just the clean up steps

4.Now Create the Search Service Application using the below blog

5.Now If you still see the error then the trick is beloe simple STSADM command
Resolution: Run the following stsadm command

stsadm -o provisionservice -action start -servicename osearch14 -servicetype "Microsoft.Office.Server.Search.Administration.SearchService, Microsoft.Office.Server.Search, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

do a simple iisreset /noforce

Thats it!!! it will start working!!!

Hope this will help and fix the issue.

Tuesday, 11 September 2012

How to split one file into many based on condition using PowerShell

I have been in a scenario where I have to spilt the CSV file content into many .CSVs based on some condition.
Below are the steps I have followed to achieve this using PowerShell.

At First I import the CSV file which I need to spit and then for each data row in the csv file call the function “CreateOrAppendCSV “  by passing two parameters each data row entry and filename.

IMPORT-CSV “C:\Source.csv” | Foreach-Object { $path=$filePath+".csv"; select-object -input $_ -prop @{Name='Name';expression={$_.Name;}},@{Name='Url';expression={$_.Url;}} |  CreateOrAppendCSV  $_ $path }

# This will create the new csv file if not exists or append to the existing csv file for position
Function CreateOrAppendCSV{
If(Test-Path $path -PathType Leaf) # This Test-Path command checks for file exists or not
    # If file exists then append using ADD-Content Command  
   $fileImport= Import-Csv $path
   $newItem= New-Object PsObject     
   $newItem | Add-Member -MemberType NoteProperty -Name "Name" -Value $item.Name
   $newItem | Add-Member -MemberType NoteProperty -Name "Url" -Value $item.Url
   $newItem | ConvertTo-Csv  -NoTypeInformation|select -Skip 1 | Add-Content $path
   $item | Export-Csv -Path $path -NoTypeInformation #Export if file not exists.

Hope this help.
Isha Jain

Friday, 7 September 2012

PowerShell with Exchange

Here is something new I learnt today.

In order to create a mailbox for an active directory user using powershell we need to Get-PSSnapin for Exchange and Import-Module for Active Directory.


#SnapIn for Exchange Mailbox
if(-not(Get-PSSnapin | Where-Object {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"}))
  Add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010

#SanpIn For SharePoint
if(-not(Get-PSSnapin | Where-Object {$_.Name -eq "Microsoft.SharePoint.PowerShell"})) {
  Add-PSSnapin Microsoft.SharePoint.PowerShell;

# Add Active Directory Snap-In
Import-Module ServerManager
Add-WindowsFeature RSAT-AD-PowerShell
Import-Module ActiveDirectory

Once this Import is done we can call the "New-Mailbox" command which will create the mailbox and AD user.

This command will create mailbox along with user creation in AD.

New-Mailbox -Name $displayName -Database $dbName  -Password $password -UserPrincipalName $userPrincipalName -Alias $samAccountName  -DisplayName $displayName -FirstName $givenName -LastName $surname -OrganizationalUnit $ouPath    

This command will create user in AD and then you can enable the mailbox

New-ADUser -Enable $True -PasswordNeverExpires $enable -PassThru  -Name $displayName -GivenName $givenName -Surname $surname -DisplayName $displayName -EmailAddress $emailAddress -SamAccountName $samAccountName -Title $title -Department $department  -UserPrincipalName $userPrincipalName -Path $path -AccountPassword $password

Enable-Mailbox $userPrincipalName –Database $dbName

Hope this help.