SharePoint 2010: PowerShell script to add in web.config


We need to add an entry in “<assemblies>” section of the “web.config” file of specific web application using power shell script


Param ( [Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)]




$WebApp = $WebApplication.Read()

Write-Host $WebApp

$configMod = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification

$configMod.Name = “add[@name=””assembly””]”

$configMod.Path = “/configuration/system.web/compilation/assemblies”

$configMod.Value = “<add assembly=””AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e”” />”

$configMod.Sequence = 0

$configMod.Type = 0 #for enum value of SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode

$configMod.Owner = “Ajax”






1 Comment »

  1. Vikram said

    Thanks. Exactly what I was looking for.

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: