Showing posts from September, 2016

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

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…