Skip to main content

Posts

PowerShell to continue from catch block if there is an error

Below code snippet will help you to continue from catch block if there is error, try{ [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")| Out-Null $Site = new-Object Microsoft.SharePoint.SPSite($siteCollUrl) $alertResultsCollection = @() $a = $ErrorActionPreference  $ErrorActionPreference = "SilentlyContinue" foreach($SiteColl in $Site.WebApplication.Sites) { if($SiteColl -ne $null) { Write-Host "Processing site " $SiteColl.URL Try{                 foreach ($web in $SiteColl.AllWebs)  { if($web -ne $null) { Try{ foreach ($alert in $web.Alerts) {                                             $alertURL = $web.URL + "/" $alertResult = New-Object PSObject $alertResult | Add-Member -type NoteProperty -...

Compare 2 CSV files and store result in 3rd CSV file using PowerShell

Below script is to compare 2 CSV files and store result in 3rd CSV file using PowerShell, $file1 = Import-CSV -Path "C:\A.CSV"  $file2 = Import-CSV -Path "C:\B.CSV" $result = Compare-Object -ReferenceObject $file2 -DifferenceObject $file1 -Property List_URL -PassThru If ($result) {     $result | Export-CSV C:\C.csv -NoTypeInformation }

Imporant technical help links for SharePoint 2013 Development

1. Expand & Collapse Content Query Webpart  http://social.technet.microsoft.com/Forums/en-US/7d601e67-8957-42a8-abfb-7cbcc61b1c24/expandcollapse-groups-in-content-query-web-part-in-sharepoint-2010?forum=sharepointcustomizationprevious http://social.msdn.microsoft.com/Forums/en-US/c15fe870-76e6-4a11-b5bd-e70110be41a8/collapse-groups-in-content-query-web-part http://store.bamboosolutions.com/sharepoint-data-viewer-web-part.aspx (using bamboo chart API) 2. Adding alias name to Sharepoint site http://social.technet.microsoft.com/Forums/sharepoint/en-US/b76cf17d-85cb-4a5e-9f7b-e0efdf438667/add-alias-url-for-a-sharepoint-site?forum=sharepointadminlegacy http://www.mssharepointtips.com/tip.asp?id=929&page=1 http://www.mssharepointtips.com/tip.asp?id=1102&page=2 3. Backing up and restoring Sharepoint site http://office.microsoft.com/en-in/windows-sharepoint-services-it/backing-up-and-restoring-web-sites-HA001160826.aspx http://www.sharepoint-journey.com/backup-and-restore...