What I want to do is with a Powershell script programatically go through all subsites in a site collection and change a column name in a list from "Web" to "Site".

So in easier words: Go through subsites 1 2 3 4 5 6... Change a column name "Web" in a list to "Site".

Any help would be much appreciated!


Have you tried something like this?

$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'} 

if ($snapin -eq $null) 
    Write-Host "Loading SharePoint Powershell Snapin"    
    Add-PSSnapin "Microsoft.SharePoint.Powershell"  -EA SilentlyContinue

$site = Get-SPSite http://portal

foreach ($web in $site.AllWebs)
    $lists = $web.Lists

    foreach ($list in $lists)
        foreach ($column in $list.Fields)
            if ($column.Title -eq "Web")
                $web.AllowUnsafeUpdates = $true
                Write-Host "Before change: " $web.Title
                $web.Title = "Site"
                Write-Host " After change: " $web.Title
                $web.AllowUnsafeUpdates = $false


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.