Posts

Showing posts from 2016

SharePoint Solution (WSP) management using PowerShell

Image
My recommended approach to manage SharePoint WSP solutions is; Powershell instead of GUI approach using SharePoint administration. Despite that, you can use the Central Administration to do that. Open SharePoint Powershell or windows Powershell using ‘Run as administrator’. If you open windows default Powershell , you need to load the SharePoint snap in explicitly, it auto loads in case of SharePoint Powershell.

PS C:\Windows\system32> add-pssnapin Microsoft.Sharepoint.Powershell


We will see some important Powershell cmdlet which are useful for solution management. (This article will be mainly focused on main parameters available with cmdlets, for all parameter details, please refer to Ms technet https://technet.microsoft.com/EN-US/library/ee906565.aspx.

Add-SPSolution

Add-SpSolution -LiteralPath [path of the wsp file with name and extension]

Add a SharePoint WSP solution to the Farm.

Build your solution in visual studio, ->Publish to a folder. You will find a WSP file named with your …

SharePoint PowerShell - BackUps and Restore

SharePoint: PowerShell - BackUps and Restore
Open Windows PowerShell using Run as admin PC> add-pssnapin Microsoft.sharepoint.powershell
BackUp & Restore in SharePoint 2013
In SharePoint 2013, you can use Windows PowerShell functionality to perform a backup or restore process for the following items: Farm Site collection Configuration database Services List or document

Farm BackUp Syntax: Backup-SPFarm -BackupMethod -Directory [-AssignmentCollection ] [-BackupThreads ] [-ConfigurationOnly ] [-Confirm []] [-Force ] [-Item ] [-Percentage ] [-WhatIf []]
Another Syntax(This doesn’t backups actually, it shows the items to be backed up in this command):
Backup-SPFarm -ShowTree [-AssignmentCollection ] [-ConfigurationOnly ] [-Confirm []] [-Item ] [-WhatIf []]
Example: PS C:\Windows\system32> backup-spfarm -directory \\KSSHRPT01\FarmBackUp -backupmethod full PS C:\Windows\system32> backup-spfarm -directory \\KSSHRPT01\FarmBackUp -backupmethod full -ConfigurationOnly
*The shared path shall be ac…

SharePoint PowerShell to Manage Term Store / Add Terms using PowerShell

Image
SharePoint PowerShell to Manage Term Store / Add Terms

//get the term store $mysite = get-spsite “http://yoursite:portnumber” $taxonomySession = get-taxonomySession -site $mysite $termStore = $taxonomySession.TermStores[“Managed Metadata Service”]

//now we will create the Term Store groups. Before we create any group we will check if the group already exists Example 1:

if($termstore.groups["News Keys"] -eq $null) { $termstoregroup = $termstore.creategroup("News Keys");  $termstore.description = "News Group";  $termstore.addgroupmanager ("KS\spadmin"); $termstore.addcontributor ("ks\k.singh");$termStore.CommitAll();}

This is not working as “description” is not an identified property.

Example 2:

if($termstore.groups["Main News Keys"] -eq $null) { echo "group is not there";  echo "group is there"; $termstoregroup = $termstore.creategroup("Main News Keys"); $termstore.commitall();   }
Example 3:
$session = Get-S…