Archive for September, 2012

Get a Listing of All SharePoint 2010 Navigation Quick Launch Hyperlinks using PowerShell

September 26, 2012 Leave a comment

Recently I had a requirement to generate a listing of all hyperlinks on every Navigation Launch for every Site Collection to search for a specific hyperlink because there was a Site that was moved and we needed to identify if there were any hyperlinks pointing to that site and remove it.

Below is the Powershell script I used to accomplish this task.


#URL to Web Application
$webApp = Get-SPWebApplication “http://portal”

#URL to search for
$searchURL = “*/sites/site1/*”

foreach ($web in $webApp | Get-SPSite -Limit All | Get-SPWeb -Limit All)

$hyperlink = $web.Navigation.QuickLaunch
“———Web:” + $web.Url >> hyperlinks.txt

foreach ($hyperlink in $hyperlinks)

if (hyperlink.Url -notlike “/*_layouts/*” -and hyperlink.Url -like $searchURL)

$hyperlinkUrl = $hyperlink.Url
“———————————Navigation Hyperlink: ” + $hyperlinkUrl >> hyperlinks.txt



Taking Ownership and Checking In Documents With No Checked In Versions in SharePoint 2007 Using PowerShell.

September 24, 2012 Leave a comment

I recently blogged about how to Get a listing of All Checked-Out Documents with No Checked-In Versions in SharePoint 2007 Using PowerShell.  That blog posting can be found here —

Now i’m going to add a little more to that blog with the ability to Take Ownership and also Check in the documents at the same time.  This can come into handy if you have alot of documents that are checked out and don’t belong to you, and you need them checked in.  Possibly for migration purposes.

Below is the modified script on how to accomplish this.

Void [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)

function CheckedOutItems()
$url=Read-Host “Please Enter In Site Url”
”SiteURL ‘t” + “FileName ‘t” + “CheckedOutTo ‘t” + “ModifiedDate ‘t” + “Version” >> c:\temp\checkedoutfiles.csv
$site = New-Object Microsoft.SharePoint.SPSite($url)
$webs = $site.AllWebs

foreach($web in $webs)
foreach($list in $listCollections)
if($list.BaseType.ToString() -eq “DocumentLibrary”)
$items = $dList.Items
$files = $dList.CheckedOutFiles
foreach($file in $files
$web.Url + “‘t” + $wuse + “‘/” + $file.LeafName + “‘t” + $file.CheckedOutBy.Name + “‘t” + $file.TimeLastModified.ToString() + “‘t” + “No Checked In Version” >> c:\temp\checkedoutfiles.csv
$file.TakeOverCheckOut() #Take ownership of checked out document
foreach($item in $list.Items)
$item.File.Checkin(“Checked in by Systems Administrator”) #Check document in
if (($list.CheckedOutFiles | Where {$_.ListItemId -eq $item.ID}) -ne $null) {continue}