Monday, December 12, 2011

Script to install SharePoint 2010 in Windows 7

You are ready to install SharePoint 2010 in Windows 7? Then you are at the right place. For the installation you have to download all required and follow the complete MSDN article and then execute step by step. If there is something which do all the steps for you then how it is? good right?
Yah! there is a great script which is written by Ram which installs SharePoint 2010 on windows 7 PC. Go and download and execute guys. Great script.

Get the information here.

How to find Inactive computer accounts in active directory?

Do you know how can we do this? Either we query the AD to get the information by writing code in C# or manually check the AD for the inactive accounts. But, there is another simple way which will get this information without any big efforts. Yes, using Powershell script.
GET-QADCOMPUTER -SizeLimit 0 -IncludedProperties LastLogonTimeStamp | where { ($CompareDate-$_.LastLogonTimeStamp).Days -gt $NumberDays } | Select-Object Name, LastLogonTimeStamp, OSName, ParentContainerDN | Sort-Object ModificationDate, Name | Export-CSV $CSVFileLocation 
You have to provide the days - the timeline of inactive accounts and where to save the output of inactive accounts list.

The complete information is available at this post.

Open PDF files directly in browser SharePoint 2010

Here is how you can tell SharePoint 2010 site to open the PDF files in the browser instead of prompting the user to save or open the PDF. This will be a great option to the most of end users. This needs simple Powershell scripting run on the server. Below is the code we should use:
# <# 
#  This script adds new MIME type to "AllowedInlineDownloadedMimeTypes" property list of defined SharePoint 2010 Web Application.
#  Script prompts you for MIME type and Web Application URL.
#  Code shall run in context of Farm Administrators group member.
#       File Name   : Add_MIME_Type.ps1 
#       Author      : Kamil Jurik, WBI Systems a.s. 
#       Created     : 11/12/2011 

If ( (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null ) {
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$WebApp = Get-SPWebApplication $(Read-Host "Enter Web Application URL")
Write-Host "Mime Type Examples:""application/pdf, text/html, text/xml"

If ($WebApp.AllowedInlineDownloadedMimeTypes -notcontains ($MimeType = Read-Host "Enter a required mime type"))
  Write-Host -ForegroundColor White "Adding" $MimeType "MIME Type to defined Web Application"$WebApp.url
  Write-Host -ForegroundColor Green "The" $MimeType "MIME type has been successfully added."
} Else {
  Write-Host -ForegroundColor Red "The" $MimeType "MIME type has already been added."
The powershell script do the magic for us. Below is the explanation.
  1. It is taking the web application url as input
  2. And if the web application is not allowed the the PDF files MIME type to it's allow downloadable mime types collection then it will add it.
So, once you run the code the files will be open up in the browser instead of prompting the user. The server will not allow PDF files by default as it think PDF files are not secure.

Note: The script should run with the account who has FARM administrator level access.
For more details about it: please check technet article.

Sunday, December 4, 2011

ASP.NET 4.5 new features

The new version of ASP.NET 4.5 has many features integrated and there are many additions to the Visual Studio as well. I am really excited to see all of these features in hand.... These functionality improvements makes applications more easier and faster. The features are added in both Web forms and MVC.

ScottGu's blog has all these features explained in detail as series of posts. Readers, please read all of these and know the new and great features coming for better productivity.

ASP.NET 4.5 New Features