powershell for sharepoint
TRANSCRIPT
Not an expert
Echo [email protected]@gmail.com503-373-8466
Basic Commands
Add-PSSnapin Microsoft.SharePoint.Powershell
Copy-SPSite http://contoso/sites/OldTeam -DestinationDatabase WSS_Content -TargetUrl http://contoso/sites/NewTeam
Get-SPDeletedSite | select Path , siteid
Full Back-upAdd-PSSnapin Microsoft.SharePoint.Powershell
Backup-SPFarm -Directory \\path\path -BackupMethod Full -Verbose
C lean-up & Delete old Back-ups# Delete the old backups keeping 7 days worth
#Adding the SharePoint snapin
Add-PSSnapin Microsoft.SharePoint.Powershell
# Location of spbrtoc.xml
$spbrtoc = "\\path\path\spbrtoc.xml"
# Keep XX days of backups
$days = 7
# Import the Sharepoint backup report xml file
[xml]$sp = gc $spbrtoc
# Find the old backups in spbrtoc.xml
$old = $sp.SPBackupRestoreHistory.SPHistoryObject |
? { $_.SPStartTime -lt ((get-date).adddays(-$days)) }
if ($old -eq $Null) { write-host "No reports of backups older than $days days found in spbrtoc.xml.`nspbrtoc.xml isn't changed and no files are removed.`n" ; break}
# Delete the old backups from the Sharepoint backup report xml file
$old | % { $sp.SPBackupRestoreHistory.RemoveChild($_) }
# Delete the physical folders in which the old backups were located
$old | % { Remove-Item $_.SPBackupDirectory -Recurse }
# Save the new Sharepoint backup report xml file
$sp.Save($spbrtoc)
Write-host "Backup(s) entries older than $days days are removed from spbrtoc.xml and harddisc."
Invalid Signatures
• Push out the registry entry cited in KB98026. We only needed ‘AllowUntrustedCertExpirationCheck’ to solve the problem.• [HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\
infopath\Security]• "AllowUntrustedCertExpirationCheck"=dword:00000001
• Apply the three .MSP files contained in the KB98026 self-extracting .EXE
• Apply the one .MSP file contained in KB981041, which is a required follow-on hotfix per the above article.
PowerShell v.s. 3rd Party Solutions
Image Credit to Wevilly Cheats at https://binweevilcompany.wordpress.com
Thing to Consider…• Metadata• Image Capture• Signatures• Move to Record Center• Automation via Workflow
Permissions and SharePoint
HREmployeeEmployee’s ManagerEmployee’s Manager’s ManagerEmployee’s Manager's Manager’s ManagerEtc…
Learning Powershell
• http://www.microsoftvirtualacademy.com/• http://www.pluralsight.com/
Blogs• http://www.happysysadm.com/2013/06/how-to-throttle-workflow-activites-
in.html• http://wannemacher.us/?p=412• http://blogs.msdn.com/b/powershell/archive/2011/04/04/scaling-and-queuing-
powershell-background-jobs.aspx