Month: May 2010

Managing SharePoint 2010 search service application file types

This post is a result of annoying UI vs CLI differences in SharePoint 2010. The central administration indicates that you specify “file types” to include in the content index. These file types are nothing but the file extensions such as PDF, DWG, etc. You generally add these file types when you install additional iFilters for indexing your SharePoint content. So, when I wanted to add the file types using PowerShell, I started looking around for a cmdlet to do that. However, you will keep searching the for cmdlets if you did not know that these “file types” are called crawl extensions in PowerShell. Yes, that is the annoying design I was referring to. Like I mentioned in an earlier post, it really feels like two different product teams worked on the management interfaces and they never spoke to each other..! Now, coming to the subject of this post, you can add file types crawl extensions by using New-SPEnterpriseSearchCrawlExtension cmdlet.

The above command will add “dwg” to the crawl extensions list. To see a list of all crawl extensions, …

Storing PowerShell ISE editor preferences using .NET isolated storage

This evening I wrote a post on how we can use .NET isolated storage in PowerShell. As a follow up, I thought it will be useful if I can show a use case for this. So, in this post, I will show a profile script I just wrote that saves any changes made to $psISE.Options and restores these options automatically using .NET isolated storage and .NET XML serialization/deserialization. This is really straightforward. Here is the script

You can just copy paste this in to your PowerShell profile script. I have put checks for $psise since I have a common profile for all the editors/consoles I am using.  After this — once you open PowerShell ISE and change any settings like background colors, font styles, etc, it all gets saved in to UISettings.xml automatically. So, next time when you open ISE, all those settings will still be intact. Using .NET XML serializer and deserializer makes it a snap to create/read XML. This is just one example of how we can use .NET isolated storage in PowerShell. …

Executing script existing only on a remote system using Invoke-Command

This is more of a personal note and may sound trivial to many of you out there. But just wanted to make sure I share it here. A while back, in my remoting series, I wrote about executing commands / scripts on a remote machine using Invoke-Command cmdlet. Talking specifically about scripts, you can use -FilePath parameter to execute scripts on a remote machine.

Note that the script you provide as a value to -FilePath must exist on the local machine or at a place accessible to the local machine. So, what if you want to run a script that exists only on the remote server? You can use script block for that. Invoke-Command -ComputerName SP2010-WFE -scriptBlock { C:\scripts\Test.PS1 } This way, you can execute the script present on a remote machine but not on the local system. I’ve published a free book on PowerShell 2.0 remoting. You can download it at: [download id=”22″ format=”4″]

On-demand import of SharePoint 2010 cmdlets within PowerShell ISE

I did not plan to write this post but a few blog posts around using SharePoint 2010 cmdlets within PowerShell ISE made me put my thoughts in to this. Last month, I published a post around using module-sets in PowerShell ISE. The idea was simple. We add a menu item to ISE addons menu and then on select of that menu item, we load a bunch of related modules for a specific task. The same thing can be done in case of SharePoint 2010 cmdlets too. This post suggests that you load SharePonit 2010 cmdlets using PowerShell profile. I would certainly do this with other “light-weight” modules but not with SharePoint 2010 snap-in. This, essentially, because this snap-in usually takes a long time (more than 7-8 secs) to load. This can be frustrating at times. I prefer loading this snap-in only when I need to those cmdlets. The method I mentioned to add addon menu item in an earlier post requires either PSISECream or ISEMenu modules. So, for those who don’t prefer using these modules, …

Announcing SharePoint 2010 PowerShell scripts & utilities codeplex project

I created this project — SharePoint 2010 PowerShell scripts & utilities, on codeplex last week to start sharing all the miscellaneous scripts I have been using throughout my SharePoint 2010 learning cycle. Most of these scripts require quite a bit of rework as they were never meant for sharing with outside world :). I am in the process of doing that and I will post each of those scripts as different modules under different categories. To start with, I am releasing SharePoint install utilities today. This module has only two cmdlets, at present. I will add remaining as time permits. SharePoint 2010 install utilities – SPinstallUtils.psm1 There are a couple of good SharePoint 2010 install automation modules (AutoSPInstaller by @brianlala & SPModule by Zach @ microsoft) already. This module is nowhere close to what they did. But this is just based on the Keep It Simple Stupid (KISS) principle. I have been using this ever since the first beta was released. In this module, you can use the Get-SPPreRequisites to download SharePoint 2010 prerequisite files …