Showing posts from May, 2018

Extract Documents to Folder based on Managed Metadata Column - SharePoint

  How to Extract documents from Multiple Document libraries in to Folders. Each has a Managed Metadata Column with Sub Terms. I have created three Functions to  Download Document Create Folder Main Method Addition to above, script will log the Document URL and destination Folder Path in .log file Create Folder   Function   Create-Folder {      param  ( $folderPath )      if  (!( Test-Path  -path  $folderPath ))     {          New-Item   $folderPath  -type directory     } } Download Document ( this is stolen from Stackoverflow 😁 ) Function   Download-Document {      param ( $web ,  $folderPath ,  $docItem )       #File Download Snippet Reffered From :        $File  =  $web .GetFile ( $docItem .Url )          $Binary  =  $File .OpenBinary ()          $detinationPath  =  $folderPath  +  "\"  +  $File .Name ;          $Stream  =  New-Object  System.IO.FileStream( $detinationPath

Delete Sub sites Using PowerShell SharePoint 2013

Delete Sub sites Using PowerShell SharePoint 2013 Recently I had to delete 50plus sub sites from one of my site collection which was created through script specified here. All my sites had a naming conversion with a number which helped me to select the site dynamically. Add-PSSnapin Microsoft.SharePoint.PowerShell [System.Reflection.Assembly] ::LoadWithPartialName ( "Microsoft.SharePoint" ) > $null $ sequencestart = 3000 ; $ maxNumber = 3100 ; $ deleteCount = 0 ; $ siteURLPrefix = "" ; for ($ i = $ sequencestart ; $ i -lt $ maxNumber ; $ i ++ ) {     $ url = $ siteURLPrefix + $ i ;     Write-Host $ url ;     #Gets the Sub site in to vairable, If Site is not existing Error Action parameter will not throw an exception     $ web = Get-SPWeb -Identity $ url -ErrorAction SilentlyContinue ;         IF ($ web )         {             Write-Host "Site Exists..."  

How to Search a Text file for a word using PowerShell

Today I had to find a way to search for specific values in set of text files. I had around 200 files with each has 6000+ records as pipe ( | ) separated File. This is how I managed to find the file(s) which was  the text. Check each file for the existence of the word or phrase which I'm looking for. If word is existing, dig deeper in to the file to find to find the record which is having search word in particular column (in my case it was NTID [windows login name of the user].  Same ID might available in different fields manage ID but I wanted to check the User Login ID I used PowerShell Contains() method and iterate the file data as | separated csv file. #Source File Path $ filePath = "C:\script\CSV" ; $ timeStamp = Get-Date ; $ ExecutionID = $ timeStamp .ToString ( "yyyyMMddHHmm" ); #All files names which contains the word will be writen in to this file $ NameSearchLogFilePath = "C:\script\logs\NameVerification- $

Pre-Upgrade Check List

Download Our Free SharePoint Pre-Upgrade Check List

* indicates required

Vintage Clan