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 Select-FileDialog | |
{ | |
param([string]$Title, [string]$Directory, [string]$Filter="All Files (*.*)|*.*" ) | |
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null | |
$objForm = New-Object System.Windows.Forms.OpenFileDialog | |
$objForm.InitialDirectory = $Directory | |
$objForm.Filter = $Filter | |
$objForm.Title = $Title | |
$Show = $objForm.ShowDialog() | |
if ($Show -eq "OK") { |
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
$username = "{username}" | |
$webAppUrl = "{url}" | |
$centralAdmin = Get-SPWebApplication -IncludeCentralAdministration | ?{$_.DisplayName -eq "SharePoint Central Administration v4"} | |
$caWeb = Get-SPWeb -Identity $centralAdmin.Url | |
$farmAdministrators = $caWeb.SiteGroups["Farm Administrators"] | |
$farmAdministrators.AddUser($username, "", $username, "Configured via PowerShell") | |
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
$service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService | |
$settings = $service.DeveloperDashboardSettings | |
$settings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On | |
$settings.Update() |
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 -ErrorAction SilentlyContinue | |
function EnsureDirectory($exportFolderPath) { | |
if (-not (Test-Path $exportFolderPath)) { | |
New-Item $exportFolderPath -Type Directory | Out-Null | |
} | |
} | |
function ExportAllWebParts($siteUrl, $pageUrl, $exportFolderPath) { | |
$web = Get-SPWeb $siteUrl |
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
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | |
choco install microsoft-build-tools | |
choco install javaruntime | |
choco install TeamCityAgent -params 'serverurl=http://{teamcityurl}:8080 agentName=Agent1 agentDir=C:\\TeamCity\\buildAgent' | |
# installs sharepoint build dependancies. Review https://officesharepointci.codeplex.com/ for more information. | |
# should convert this to a chocolatey package too :) | |
.\OfficeSharePointCI\TfsBuildServerPrerequisites.ps1 -Install |
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
Set-ExecutionPolicy -ExecutionPolicy Bypass -Force | |
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
cinst googlechrome -y | |
cinst slack -y | |
cinst vscode -y | |
cinst sql-server-management-studio -y | |
cinst firacode -y |
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 New-Zip ( $zipFile, $file ) { | |
if ($file -is [string]) { | |
$file = Get-Item $file | |
} | |
set-content $zipFile ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18)) | |
$zipFile = Get-Item $zipFile | |
$zipFile.IsReadOnly = $false | |
$zip = (New-Object -ComObject shell.application).NameSpace($zipFile.FullName) |
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 Extract-Zip ($zipFile, $directory = ".\") { | |
if ($directory -is [string]) { | |
$directory = Get-Item $directory } | |
if ($zipFile -is [string]) { | |
$zipFile = Get-Item $zipFile } | |
$zip = (New-Object -ComObject shell.application).NameSpace($zipFile.FullName) | |
$destination = (New-Object -ComObject shell.application).namespace($directory.FullName) |
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
$app = get-spwebapplication "http://{webapp_url}" | |
$mods = $app.WebConfigModifications | |
$mods.Remove(($mods | out-gridview -PassThru)) | |
$app.Parent.Update() | |
$app.Parent.ApplyWebConfigModifications() |
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
$folders = @("_drafts", "_includes", "_layouts", "_posts", "_data") | |
$folders | %{ New-Item -Name $_ -ItemType Directory } | |
$files = @("_config.yml") | |
$files | %{ New-Item -Name $_ -ItemType File } |
OlderNewer