This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath | |
| $rss = (new-object net.webclient) | |
| $a = [xml]($rss.downloadstring("http://channel9.msdn.com/Events/SharePoint-Conference/2014/RSS/mp4high")) | |
| $a.rss.channel.item | foreach { | |
| $code = $_.comments.split("/") | select -last 1 | |
| $url = New-Object System.Uri($_.enclosure.url) | |
| $file = $code + "-" + $_.creator + "-" + $_.title.Replace("'","").Replace("*","").Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $webappName = “http://intranet.contoso.com” | |
| $backupDir = “C:\backups” | |
| Write-Host "Backing up $webappName web.config file…" -foreground Gray –nonewline | |
| ## Get the web application – by display name | |
| $w = Get-SPWebApplication | where { $_.DisplayName -eq "$webappName"} | |
| ## Get the default (first) zone for the web app… | |
| ## You may wish to iterate through all the available zones |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add-PSSnapin Microsoft.SharePoint.PowerShell | |
| $siteUrl = "http://mycoolsite/" | |
| $accountName = "MyAccountName" | |
| $site = Get-SPSite $siteUrl | |
| $context = Get-SPServiceContext($site) | |
| $pm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($context) | |
| # If user profile doesn't exist create new one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server") | |
| [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.UserProfiles") | |
| [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | |
| # Enter your SharePoint site URL here... | |
| $site = new-object Microsoft.SharePoint.SPSite("http://intranet"); | |
| $web = Get-SPWeb "http://intranet"; | |
| $ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| psconfig -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Get-SPFarmSolutions { | |
| param ( | |
| [string] $directory = $(Read-Host -prompt "Enter a directory (use ""."" for current dir)") | |
| ) | |
| if ($directory.Length -lt 2) { | |
| $directory = [string]$pwd + "\\"; | |
| } | |
| $farm = [Microsoft.SharePoint.Administration.SPFarm]::Local; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Set-SPUIVersion( | |
| [string]$dbName = $(Read-Host -prompt "Content Database Name"), | |
| [int32]$uiVersion = $(Read-Host -prompt "UI Version")) | |
| { | |
| $db = Get-SPContentDatabase $dbName | |
| foreach ($s in $db.Sites) { | |
| foreach ($w in $s.AllWebs) { | |
| $w.UIversion = $uiVersion; | |
| switch ($uiVersion) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Sample Use | |
| # Set-SPListContentTypeWorkflowAssocationCleanup -WebUrl "http://intranet" -ListName "Shared Documents" -ContentTypeName "Document Content Type" -CleanupDays 365 -ReportOnly:$false | |
| function Set-SPListContentTypeWorkflowAssocationCleanup { | |
| param ( | |
| [string] $WebUrl = $(Read-Host -prompt "Enter a Url"), | |
| [string] $ListName = $(Read-Host -prompt "Enter a List Name"), | |
| [string] $ContentTypeName = $(Read-Host -prompt "Enter a Content Type Name"), | |
| [int32] $CleanupDays = $(Read-Host -prompt "Enter the number of Cleanup Days"), | |
| [switch] $ReportOnly = $true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Sample Usage | |
| # Set-SPListWorkflowAssocationCleanup -WebUrl "http://intranet" -ListName "Shared Documents" -CleanupDays 365 -ReportOnly:$false | |
| function Set-SPListWorkflowAssocationCleanup { | |
| param ( | |
| [string] $WebUrl = $(Read-Host -prompt "Enter a Url"), | |
| [string] $ListName = $(Read-Host -prompt "Enter a List Name"), | |
| [int32] $CleanupDays = $(Read-Host -prompt "Enter the number of Cleanup Days"), | |
| [switch] $ReportOnly = $true | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Function-Name { | |
| <# | |
| .Synopsis | |
| The short function description. | |
| .Description | |
| The long function description | |
| .Example | |
| C:\PS>Function-Name -param "Param Value" | |
| This example does something |
NewerOlder