full_path
stringlengths 31
232
| filename
stringlengths 4
167
| content
stringlengths 0
48.3M
|
|---|---|---|
PowerShellCorpus/PowerShellGallery/Eventbrite/0.0.2/Public/Get/Tests/Get-EventbriteEvent.Tests.ps1
|
Get-EventbriteEvent.Tests.ps1
|
Describe 'Get-EventbriteEvent Tests' {
Context 'Parameters for Get-EventbriteEvent'{
It 'Has a Parameter called EventbriteToken' {
$Function.Parameters.Keys.Contains('EventbriteToken') | Should Be 'True'
}
It 'EventbriteToken Parameter is Identified as Mandatory being True' {
[String]$Function.Parameters.EventbriteToken.Attributes.Mandatory | Should be 'True'
}
It 'EventbriteToken Parameter is of String Type' {
$Function.Parameters.EventbriteToken.ParameterType.FullName | Should be 'System.String'
}
It 'EventbriteToken Parameter is member of ParameterSets' {
[String]$Function.Parameters.EventbriteToken.ParameterSets.Keys | Should Be '__AllParameterSets'
}
It 'EventbriteToken Parameter Position is defined correctly' {
[String]$Function.Parameters.EventbriteToken.Attributes.Position | Should be '0'
}
It 'Does EventbriteToken Parameter Accept Pipeline Input?' {
[String]$Function.Parameters.EventbriteToken.Attributes.ValueFromPipeline | Should be 'False'
}
It 'Does EventbriteToken Parameter Accept Pipeline Input by PropertyName?' {
[String]$Function.Parameters.EventbriteToken.Attributes.ValueFromPipelineByPropertyName | Should be 'False'
}
It 'Does EventbriteToken Parameter use advanced parameter Validation? ' {
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateNotNullOrEmptyAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateNotNullAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateScript' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateRangeAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidatePatternAttribute' | Should Be 'False'
}
It 'Has Parameter Help Text for EventbriteToken '{
$function.Definition.Contains('.PARAMETER EventbriteToken') | Should Be 'True'
}
It 'Has a Parameter called EventID' {
$Function.Parameters.Keys.Contains('EventID') | Should Be 'True'
}
It 'EventID Parameter is Identified as Mandatory being True' {
[String]$Function.Parameters.EventID.Attributes.Mandatory | Should be 'True'
}
It 'EventID Parameter is of String Type' {
$Function.Parameters.EventID.ParameterType.FullName | Should be 'System.String'
}
It 'EventID Parameter is member of ParameterSets' {
[String]$Function.Parameters.EventID.ParameterSets.Keys | Should Be '__AllParameterSets'
}
It 'EventID Parameter Position is defined correctly' {
[String]$Function.Parameters.EventID.Attributes.Position | Should be '1'
}
It 'Does EventID Parameter Accept Pipeline Input?' {
[String]$Function.Parameters.EventID.Attributes.ValueFromPipeline | Should be 'False'
}
It 'Does EventID Parameter Accept Pipeline Input by PropertyName?' {
[String]$Function.Parameters.EventID.Attributes.ValueFromPipelineByPropertyName | Should be 'False'
}
It 'Does EventID Parameter use advanced parameter Validation? ' {
$Function.Parameters.EventID.Attributes.TypeID.Name -contains 'ValidateNotNullOrEmptyAttribute' | Should Be 'False'
$Function.Parameters.EventID.Attributes.TypeID.Name -contains 'ValidateNotNullAttribute' | Should Be 'False'
$Function.Parameters.EventID.Attributes.TypeID.Name -contains 'ValidateScript' | Should Be 'False'
$Function.Parameters.EventID.Attributes.TypeID.Name -contains 'ValidateRangeAttribute' | Should Be 'False'
$Function.Parameters.EventID.Attributes.TypeID.Name -contains 'ValidatePatternAttribute' | Should Be 'False'
}
It 'Has Parameter Help Text for EventID '{
$function.Definition.Contains('.PARAMETER EventID') | Should Be 'True'
}
}
Context "Function $($function.Name) - Help Section" {
It "Function $($function.Name) Has show-help comment block" {
$function.Definition.Contains('<#') | should be 'True'
$function.Definition.Contains('#>') | should be 'True'
}
It "Function $($function.Name) Has show-help comment block has a.SYNOPSIS" {
$function.Definition.Contains('.SYNOPSIS') -or $function.Definition.Contains('.Synopsis') | should be 'True'
}
It "Function $($function.Name) Has show-help comment block has an example" {
$function.Definition.Contains('.EXAMPLE') | should be 'True'
}
It "Function $($function.Name) Is an advanced function" {
$function.CmdletBinding | should be 'True'
$function.Definition.Contains('param') -or $function.Definition.Contains('Param') | should be 'True'
}
}
}
|
PowerShellCorpus/PowerShellGallery/Eventbrite/0.0.2/Public/Get/Tests/Get-EventbriteEventQuestions.Tests.ps1
|
Get-EventbriteEventQuestions.Tests.ps1
|
Describe 'Get-EventbriteEventQuestions Tests' {
Context 'Parameters for Get-EventbriteEventQuestions'{
It 'Has a Parameter called EventbriteToken' {
$Function.Parameters.Keys.Contains('EventbriteToken') | Should Be 'True'
}
It 'EventbriteToken Parameter is Identified as Mandatory being True' {
[String]$Function.Parameters.EventbriteToken.Attributes.Mandatory | Should be 'True'
}
It 'EventbriteToken Parameter is of String Type' {
$Function.Parameters.EventbriteToken.ParameterType.FullName | Should be 'System.String'
}
It 'EventbriteToken Parameter is member of ParameterSets' {
[String]$Function.Parameters.EventbriteToken.ParameterSets.Keys | Should Be '__AllParameterSets'
}
It 'EventbriteToken Parameter Position is defined correctly' {
[String]$Function.Parameters.EventbriteToken.Attributes.Position | Should be '0'
}
It 'Does EventbriteToken Parameter Accept Pipeline Input?' {
[String]$Function.Parameters.EventbriteToken.Attributes.ValueFromPipeline | Should be 'False'
}
It 'Does EventbriteToken Parameter Accept Pipeline Input by PropertyName?' {
[String]$Function.Parameters.EventbriteToken.Attributes.ValueFromPipelineByPropertyName | Should be 'False'
}
It 'Does EventbriteToken Parameter use advanced parameter Validation? ' {
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateNotNullOrEmptyAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateNotNullAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateScript' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateRangeAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidatePatternAttribute' | Should Be 'False'
}
It 'Has Parameter Help Text for EventbriteToken '{
$function.Definition.Contains('.PARAMETER EventbriteToken') | Should Be 'True'
}
It 'Has a Parameter called EventID' {
$Function.Parameters.Keys.Contains('EventID') | Should Be 'True'
}
It 'EventID Parameter is Identified as Mandatory being True' {
[String]$Function.Parameters.EventID.Attributes.Mandatory | Should be 'True'
}
It 'EventID Parameter is of String Type' {
$Function.Parameters.EventID.ParameterType.FullName | Should be 'System.String'
}
It 'EventID Parameter is member of ParameterSets' {
[String]$Function.Parameters.EventID.ParameterSets.Keys | Should Be '__AllParameterSets'
}
It 'EventID Parameter Position is defined correctly' {
[String]$Function.Parameters.EventID.Attributes.Position | Should be '1'
}
It 'Does EventID Parameter Accept Pipeline Input?' {
[String]$Function.Parameters.EventID.Attributes.ValueFromPipeline | Should be 'False'
}
It 'Does EventID Parameter Accept Pipeline Input by PropertyName?' {
[String]$Function.Parameters.EventID.Attributes.ValueFromPipelineByPropertyName | Should be 'False'
}
It 'Does EventID Parameter use advanced parameter Validation? ' {
$Function.Parameters.EventID.Attributes.TypeID.Name -contains 'ValidateNotNullOrEmptyAttribute' | Should Be 'False'
$Function.Parameters.EventID.Attributes.TypeID.Name -contains 'ValidateNotNullAttribute' | Should Be 'False'
$Function.Parameters.EventID.Attributes.TypeID.Name -contains 'ValidateScript' | Should Be 'False'
$Function.Parameters.EventID.Attributes.TypeID.Name -contains 'ValidateRangeAttribute' | Should Be 'False'
$Function.Parameters.EventID.Attributes.TypeID.Name -contains 'ValidatePatternAttribute' | Should Be 'False'
}
It 'Has Parameter Help Text for EventID '{
$function.Definition.Contains('.PARAMETER EventID') | Should Be 'True'
}
}
Context "Function $($function.Name) - Help Section" {
It "Function $($function.Name) Has show-help comment block" {
$function.Definition.Contains('<#') | should be 'True'
$function.Definition.Contains('#>') | should be 'True'
}
It "Function $($function.Name) Has show-help comment block has a.SYNOPSIS" {
$function.Definition.Contains('.SYNOPSIS') -or $function.Definition.Contains('.Synopsis') | should be 'True'
}
It "Function $($function.Name) Has show-help comment block has an example" {
$function.Definition.Contains('.EXAMPLE') | should be 'True'
}
It "Function $($function.Name) Is an advanced function" {
$function.CmdletBinding | should be 'True'
$function.Definition.Contains('param') -or $function.Definition.Contains('Param') | should be 'True'
}
}
}
|
PowerShellCorpus/PowerShellGallery/Eventbrite/0.0.2/Public/Get/Tests/Get-EventAttendees.Tests.ps1
|
Get-EventAttendees.Tests.ps1
|
Describe 'Get-EventAttendees Tests' {
Context 'Parameters for Get-EventAttendees'{
It 'Has a Parameter called EventbriteToken' {
$Function.Parameters.Keys.Contains('EventbriteToken') | Should Be 'True'
}
It 'EventbriteToken Parameter is Identified as Mandatory being True' {
[String]$Function.Parameters.EventbriteToken.Attributes.Mandatory | Should be 'True'
}
It 'EventbriteToken Parameter is of String Type' {
$Function.Parameters.EventbriteToken.ParameterType.FullName | Should be 'System.String'
}
It 'EventbriteToken Parameter is member of ParameterSets' {
[String]$Function.Parameters.EventbriteToken.ParameterSets.Keys | Should Be '__AllParameterSets'
}
It 'EventbriteToken Parameter Position is defined correctly' {
[String]$Function.Parameters.EventbriteToken.Attributes.Position | Should be '0'
}
It 'Does EventbriteToken Parameter Accept Pipeline Input?' {
[String]$Function.Parameters.EventbriteToken.Attributes.ValueFromPipeline | Should be 'False'
}
It 'Does EventbriteToken Parameter Accept Pipeline Input by PropertyName?' {
[String]$Function.Parameters.EventbriteToken.Attributes.ValueFromPipelineByPropertyName | Should be 'False'
}
It 'Does EventbriteToken Parameter use advanced parameter Validation? ' {
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateNotNullOrEmptyAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateNotNullAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateScript' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateRangeAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidatePatternAttribute' | Should Be 'False'
}
It 'Has Parameter Help Text for EventbriteToken '{
$function.Definition.Contains('.PARAMETER EventbriteToken') | Should Be 'True'
}
}
Context "Function $($function.Name) - Help Section" {
It "Function $($function.Name) Has show-help comment block" {
$function.Definition.Contains('<#') | should be 'True'
$function.Definition.Contains('#>') | should be 'True'
}
It "Function $($function.Name) Has show-help comment block has a.SYNOPSIS" {
$function.Definition.Contains('.SYNOPSIS') -or $function.Definition.Contains('.Synopsis') | should be 'True'
}
It "Function $($function.Name) Has show-help comment block has an example" {
$function.Definition.Contains('.EXAMPLE') | should be 'True'
}
It "Function $($function.Name) Is an advanced function" {
$function.CmdletBinding | should be 'True'
$function.Definition.Contains('param') -or $function.Definition.Contains('Param') | should be 'True'
}
}
}
|
PowerShellCorpus/PowerShellGallery/Eventbrite/0.0.2/Public/Get/Tests/Get-EventbriteEvents.Tests.ps1
|
Get-EventbriteEvents.Tests.ps1
|
Describe 'Get-EventbriteEvents Tests' {
Context 'Parameters for Get-EventbriteEvents'{
It 'Has a Parameter called EventbriteToken' {
$Function.Parameters.Keys.Contains('EventbriteToken') | Should Be 'True'
}
It 'EventbriteToken Parameter is Identified as Mandatory being True' {
[String]$Function.Parameters.EventbriteToken.Attributes.Mandatory | Should be 'True'
}
It 'EventbriteToken Parameter is of String Type' {
$Function.Parameters.EventbriteToken.ParameterType.FullName | Should be 'System.String'
}
It 'EventbriteToken Parameter is member of ParameterSets' {
[String]$Function.Parameters.EventbriteToken.ParameterSets.Keys | Should Be '__AllParameterSets'
}
It 'EventbriteToken Parameter Position is defined correctly' {
[String]$Function.Parameters.EventbriteToken.Attributes.Position | Should be '0'
}
It 'Does EventbriteToken Parameter Accept Pipeline Input?' {
[String]$Function.Parameters.EventbriteToken.Attributes.ValueFromPipeline | Should be 'False'
}
It 'Does EventbriteToken Parameter Accept Pipeline Input by PropertyName?' {
[String]$Function.Parameters.EventbriteToken.Attributes.ValueFromPipelineByPropertyName | Should be 'False'
}
It 'Does EventbriteToken Parameter use advanced parameter Validation? ' {
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateNotNullOrEmptyAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateNotNullAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateScript' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidateRangeAttribute' | Should Be 'False'
$Function.Parameters.EventbriteToken.Attributes.TypeID.Name -contains 'ValidatePatternAttribute' | Should Be 'False'
}
It 'Has Parameter Help Text for EventbriteToken '{
$function.Definition.Contains('.PARAMETER EventbriteToken') | Should Be 'True'
}
}
Context "Function $($function.Name) - Help Section" {
It "Function $($function.Name) Has show-help comment block" {
$function.Definition.Contains('<#') | should be 'True'
$function.Definition.Contains('#>') | should be 'True'
}
It "Function $($function.Name) Has show-help comment block has a.SYNOPSIS" {
$function.Definition.Contains('.SYNOPSIS') -or $function.Definition.Contains('.Synopsis') | should be 'True'
}
It "Function $($function.Name) Has show-help comment block has an example" {
$function.Definition.Contains('.EXAMPLE') | should be 'True'
}
It "Function $($function.Name) Is an advanced function" {
$function.CmdletBinding | should be 'True'
$function.Definition.Contains('param') -or $function.Definition.Contains('Param') | should be 'True'
}
}
}
|
PowerShellCorpus/PowerShellGallery/PSNewRelic/0.8.4/Public/Set-PSNewRelicConfig.ps1
|
Set-PSNewRelicConfig.ps1
|
function Set-PSNewRelicConfig {
[cmdletbinding()]
param(
[string]$AccountID,
[string]$APIKey,
[string]$AdminAPIKey,
[string]$InsightsInsertKey,
[string]$InsightsQueryKey,
[string]$Path = "$ModuleRoot\$env:USERNAME-$env:COMPUTERNAME-PSNewRelic.xml"
)
Switch ($PSBoundParameters.Keys)
{
'AccountID'{$Script:PSNewRelic.AccountID = $AccountID}
'APIKey'{$Script:PSNewRelic.APIKey = $APIKey}
'AdminAPIKey'{$Script:PSNewRelic.AdminAPIKey = $AdminAPIKey}
'InsightsInsertKey'{$Script:PSNewRelic.InsightsInsertKey = $InsightsInsertKey}
'InsightsQueryKey'{$Script:PSNewRelic.InsightsQueryKey = $InsightsQueryKey}
}
Function Encrypt {
param([string]$string)
if($String -notlike '')
{
ConvertTo-SecureString -String $string -AsPlainText -Force
}
}
#Write the global variable and the xml
$Script:PSNewRelic | Select -Property @{N="AccountID";E={Encrypt $_.AccountID}},@{N='APIKey';E={Encrypt $_.APIKey}},@{N='AdminAPIKey';E={Encrypt $_.AdminAPIKey}},@{N='InsightsInsertKey';E={Encrypt $_.InsightsInsertKey}},@{N='InsightsQueryKey';E={Encrypt $_.InsightsQueryKey}} | Export-Clixml -Path $Path -Force
}
|
PowerShellCorpus/PowerShellGallery/PSNewRelic/0.8.4/Public/Invoke-NewRelicInsightsQuery.ps1
|
Invoke-NewRelicInsightsQuery.ps1
|
function Invoke-NewRelicInsightsQuery {
[cmdletbinding()]
Param
(
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]
$InsightsQuery,
[parameter(Mandatory=$false)]
[switch]
$Raw,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[String]
$InsightsQueryKey=$Script:PSNewRelic.InsightsQueryKey,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[String]
$AccountID=$Script:PSNewRelic.AccountID
)
$headers = @{
"X-Query-Key" = $InsightsQueryKey
}
$RestParams=@{
Method = "Get"
ContentType = "application/json"
Headers = $headers
}
try
{
$URI = "https://insights-api.newrelic.com/v1/accounts/$AccountID/query?nrql=$InsightsQuery"
$response = Invoke-RestMethod -Uri $URI @RestParams
}
catch
{
Write-Error $Error[0]
return
}
return $response
}
|
PowerShellCorpus/PowerShellGallery/PSNewRelic/0.8.4/Public/Get-NewRelicApplicationHostList.ps1
|
Get-NewRelicApplicationHostList.ps1
|
function Get-NewRelicApplicationHostList {
[cmdletbinding(DefaultParameterSetName="AllPages")]
Param
(
[parameter(Mandatory=$true)]
[String]
$ApplicationID,
[parameter(Mandatory=$false,ParameterSetName="PageNum")]
[int]
$PageNumber=1,
[parameter(Mandatory=$false,ParameterSetName="AllPages")]
[switch]
$AllPages=$true,
[parameter(Mandatory=$false)]
[switch]
$Raw,
[parameter(Mandatory=$false)]
[String]
$APIKey=$Script:PSNewRelic.APIKey
)
$headers = @{
"X-Api-Key" = $APIKey
}
if ($AllPages)
{
$response = @()
$i=0
do
{
try
{
$i++
$URI = "https://api.newrelic.com/v2/applications/$ApplicationID/hosts.json?page=$i"
$result = Invoke-RestMethod -Method Get -Uri $URI -ContentType "application/json" -Headers $headers | Select-Object -ExpandProperty application_hosts
if (!$Raw)
{
$result = $result |
Select-Object -Property `
@{N="Host_ID";E={$_.ID}},`
@{N="Host_Name";E={$_.Language}},`
@{N="App_Name";E={$_.Name}},`
@{N="App_Language";E={$_.Language}},`
@{N="App_HealthStatus";E={$_.health_status}},`
@{N="App_Throughput";E={$_.application_summary.throughput}},`
@{N="App_ResponseTime";E={$_.application_summary.response_time}},`
@{N="App_ErrorRate";E={$_.application_summary.error_rate}},`
@{N="App_ApdexScore";E={$_.application_summary.apdex_score}}
}
$response += $result
}
catch
{
Write-Error $Error[0]
return
}
}
until (!$result)
}
else
{
try
{
$URI = "https://api.newrelic.com/v2/applications/$ApplicationID/hosts.json?page=$PageNumber"
$response = Invoke-RestMethod -Method Get -Uri $URI -ContentType "application/json" -Headers $headers | Select-Object -ExpandProperty application_hosts
if (!$Raw)
{
$response = $response |
Select-Object -Property `
@{N="Host_ID";E={$_.ID}},`
@{N="Host_Name";E={$_.Language}},`
@{N="App_Name";E={$_.Name}},`
@{N="App_Language";E={$_.Language}},`
@{N="App_HealthStatus";E={$_.health_status}},`
@{N="App_Throughput";E={$_.application_summary.throughput}},`
@{N="App_ResponseTime";E={$_.application_summary.response_time}},`
@{N="App_ErrorRate";E={$_.application_summary.error_rate}},`
@{N="App_ApdexScore";E={$_.application_summary.apdex_score}}
}
}
catch
{
Write-Error $Error[0]
return
}
}
return $response
}
|
PowerShellCorpus/PowerShellGallery/PSNewRelic/0.8.4/Public/Get-NewRelicApplicationList.ps1
|
Get-NewRelicApplicationList.ps1
|
function Get-NewRelicApplicationList {
[cmdletbinding(DefaultParameterSetName="AllPages")]
Param
(
[parameter(Mandatory=$false)]
[string]
$Name,
[parameter(Mandatory=$false,ParameterSetName="PageNum")]
[int]
$PageNumber=1,
[parameter(Mandatory=$false,ParameterSetName="AllPages")]
[switch]
$AllPages=$true,
[parameter(Mandatory=$false)]
[switch]
$Raw,
[parameter(Mandatory=$false)]
[String]
$APIKey=$Script:PSNewRelic.APIKey
)
$headers = @{
"X-Api-Key" = $APIKey
}
$body = @{}
$RestParams=@{
Method = "Get"
ContentType = "application/json"
Headers = $headers
}
if ($Name){
$body.Add("filter[name]",$Name)
}
if($body.Count)
{
$RestParams.Add("Body",$body)
}
if ($AllPages)
{
$response = @()
$i=0
do
{
try
{
$i++
$URI = "https://api.newrelic.com/v2/applications.json?page=$i"
$result = Invoke-RestMethod -Uri $URI @RestParams | Select-Object -ExpandProperty applications
if(!$Raw)
{
$result = $result |
Select-Object -Property `
@{N="ID";E={$_.ID}},`
@{N="Name";E={$_.Name}},`
@{N="Language";E={$_.Language}},`
@{N="Reporting";E={$_.Reporting}},`
@{N="LastReportedAt";E={"$(Get-Date "$($_.last_reported_at)" -Format G) $([TimeZoneInfo]::Local.BaseUtcOffset.ToString())"}},`
@{N="HealthStatus";E={$_.health_status}},`
@{N="Throughput";E={$_.application_summary.throughput}},`
@{N="ResponseTime";E={$_.application_summary.response_time}},`
@{N="ErrorRate";E={$_.application_summary.error_rate}},`
@{N="ApdexTarget";E={$_.application_summary.apdex_target}},`
@{N="ApdexScore";E={$_.application_summary.apdex_score}},`
@{N="HostCount";E={$_.application_summary.host_count}},`
@{N="InstanceCount";E={$_.application_summary.instance_count}}
}
$response += $result
}
catch
{
Write-Error $Error[0]
return
}
}
until (!$result)
}
else
{
try
{
$URI = "https://api.newrelic.com/v2/applications.json?page=$PageNumber"
$response = Invoke-RestMethod -Uri $URI @RestParams | Select-Object -ExpandProperty applications
if(!$Raw)
{
$response = $response |
Select-Object -Property `
@{N="ID";E={$_.ID}},`
@{N="Name";E={$_.Name}},`
@{N="Language";E={$_.Language}},`
@{N="Reporting";E={$_.Reporting}},`
@{N="LastReportedAt";E={"$(Get-Date "$($_.last_reported_at)" -Format G) $([TimeZoneInfo]::Local.BaseUtcOffset.ToString())"}},`
@{N="HealthStatus";E={$_.health_status}},`
@{N="Throughput";E={$_.application_summary.throughput}},`
@{N="ResponseTime";E={$_.application_summary.response_time}},`
@{N="ErrorRate";E={$_.application_summary.error_rate}},`
@{N="ApdexTarget";E={$_.application_summary.apdex_target}},`
@{N="ApdexScore";E={$_.application_summary.apdex_score}},`
@{N="HostCount";E={$_.application_summary.host_count}},`
@{N="InstanceCount";E={$_.application_summary.instance_count}}
}
}
catch
{
Write-Error $Error[0]
return
}
}
return $response
}
|
PowerShellCorpus/PowerShellGallery/PSNewRelic/0.8.4/Public/Get-NewRelicServerList.ps1
|
Get-NewRelicServerList.ps1
|
function Get-NewRelicServerList {
[cmdletbinding(DefaultParameterSetName="AllPages")]
Param
(
[parameter(Mandatory=$false)]
[string]
$Name,
[parameter(Mandatory=$false,ParameterSetName="PageNum")]
[int]
$PageNumber=1,
[parameter(Mandatory=$false,ParameterSetName="AllPages")]
[switch]
$AllPages=$true,
[parameter(Mandatory=$false)]
[switch]
$Raw,
[parameter(Mandatory=$false)]
[String]
$APIKey=$Script:PSNewRelic.APIKey
)
$headers = @{
"X-Api-Key" = $APIKey
}
$body = @{}
$RestParams=@{
Method = "Get"
ContentType = "application/json"
Headers = $headers
}
if ($Name){
$body.Add("filter[name]",$Name)
}
if($body.Count)
{
$RestParams.Add("Body",$body)
}
if ($AllPages)
{
$response = @()
$i=0
do
{
try
{
$i++
$URI = "https://api.newrelic.com/v2/servers.json?page=$i"
$result = Invoke-RestMethod -Uri $URI @RestParams | Select-Object -ExpandProperty Servers
if (!$Raw)
{
$result = $result |
Select-Object -Property `
@{N="ID";E={$_.ID}},`
@{N="Name";E={$_.Name}},`
@{N="Host";E={$_.Host}},`
@{N="Reporting";E={$_.Reporting}},`
@{N="LastReportedAt";E={"$(Get-Date "$($_.last_reported_at)" -Format G) $([TimeZoneInfo]::Local.BaseUtcOffset.ToString())"}},`
@{N="HealthStatus";E={$_.health_status}},`
@{N="CPU";E={if($_.summary.cpu){"$($_.summary.cpu)%"}}},`
@{N="CPUStolen";E={$_.summary.cpu_stolen}},`
@{N="Memory";E={if($_.summary.memory){"$($_.summary.memory)%"}}},`
@{N="MemoryUsed";E={if($_.summary.memory_used){"$([math]::round($($_.summary.memory_used / 1GB),2)) GB"}}},`
@{N="MemoryTotal";E={if($_.summary.memory_total){"$([math]::round($($_.summary.memory_total / 1GB),2)) GB"}}},`
@{N="DiskIO";E={if($_.summary.disk_io){"$($_.summary.disk_io)%"}}},`
@{N="FullestDisk";E={if($_.summary.fullest_disk){"$($_.summary.fullest_disk)%"}}},`
@{N="FullestDiskFree";E={if($_.summary.fullest_disk_free){"$([math]::round($($_.summary.fullest_disk_free / 1GB),2)) GB"}}}
}
$response += $result
}
catch
{
Write-Error $Error[0]
return
}
}
until (!$result)
}
else
{
try
{
$URI = "https://api.newrelic.com/v2/servers.json?page=$PageNumber"
$response = Invoke-RestMethod -Uri $URI @RestParams | Select-Object -ExpandProperty Servers
if (!$Raw)
{
$response = $response |
Select-Object -Property `
@{N="ID";E={$_.ID}},`
@{N="Name";E={$_.Name}},`
@{N="Host";E={$_.Host}},`
@{N="Reporting";E={$_.Reporting}},`
@{N="LastReportedAt";E={"$(Get-Date "$($_.last_reported_at)" -Format G) $([TimeZoneInfo]::Local.BaseUtcOffset.ToString())"}},`
@{N="HealthStatus";E={$_.health_status}},`
@{N="CPU";E={if($_.summary){"$($_.summary.cpu)%"}}},`
@{N="CPUStolen";E={$_.summary}},`
@{N="Memory";E={if($_.summary){"$($_.summary.memory)%"}}},`
@{N="MemoryUsed";E={if($_.summary){"$([math]::round($($_.summary.memory_used / 1GB),2)) GB"}}},`
@{N="MemoryTotal";E={if($_.summary){"$([math]::round($($_.summary.memory_total / 1GB),2)) GB"}}},`
@{N="DiskIO";E={if($_.summary){"$($_.summary.disk_io)%"}}},`
@{N="FullestDisk";E={if($_.summary){"$($_.summary.fullest_disk)%"}}},`
@{N="FullestDiskFree";E={if($_.summary){"$([math]::round($($_.summary.fullest_disk_free / 1GB),2)) GB"}}}
}
}
catch
{
Write-Error $Error[0]
return
}
}
return $response
}
|
PowerShellCorpus/PowerShellGallery/PSNewRelic/0.8.4/Public/Get-NewRelicSyntheticsMonitorList.ps1
|
Get-NewRelicSyntheticsMonitorList.ps1
|
function Get-NewRelicSyntheticsMonitorList {
[cmdletbinding()]
Param
(
[parameter(Mandatory=$false)]
[switch]
$Raw,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[String]
$AdminAPIKey=$Script:PSNewRelic.AdminAPIKey,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[String]
$AccountID=$Script:PSNewRelic.AccountID
)
$RestParams=@{
Method = "Get"
ContentType = "application/json"
Headers = @{"X-API-Key" = $AdminAPIKey}
Uri = "https://synthetics.newrelic.com/synthetics/api/v3/monitors"
}
try
{
$response = Invoke-RestMethod @RestParams
}
catch
{
$Error[0]
}
return $response
}
|
PowerShellCorpus/PowerShellGallery/PSNewRelic/0.8.4/Public/Get-NewRelicDeploymentList.ps1
|
Get-NewRelicDeploymentList.ps1
|
function Get-NewRelicDeploymentList {
[cmdletbinding(DefaultParameterSetName="AllPages")]
Param
(
[parameter(Mandatory=$true)]
[string]
$ApplicationID,
[parameter(Mandatory=$false)]
[string]
$ApplicationName,
[parameter(Mandatory=$false,ParameterSetName="PageNum")]
[int]
$PageNumber=1,
[parameter(Mandatory=$false,ParameterSetName="AllPages")]
[switch]
$AllPages=$true,
[parameter(Mandatory=$false)]
[switch]
$Raw,
[parameter(Mandatory=$false)]
[String]
$APIKey=$Script:PSNewRelic.APIKey
)
$headers = @{
"X-Api-Key" = $APIKey
}
$RestParams=@{
Method = "Get"
ContentType = "application/json"
Headers = $headers
}
if ($AllPages)
{
$response = @()
$i=0
do
{
try
{
$i++
$URI = "https://api.newrelic.com/v2/applications/$ApplicationID/deployments.json?page=$i"
$result = Invoke-RestMethod -Uri $URI @RestParams | Select-Object -ExpandProperty deployments
if(!$Raw)
{
$result = $result |
Select-Object -Property `
@{N="ID";E={$_.ID}},
@{N="Revision";E={$_.revision}},
@{N="ChangeLog";E={$_.changelog}},
@{N="Description";E={$_.description}},
@{N="User";E={$_.user}},
@{N="Timestamp";E={[datetime]$_.timestamp}},
@{N="ApplicationID";E={$_.links.application}},
@{N="ApplicationName";E={if($ApplicationName){$ApplicationName}}}
}
$response += $result
}
catch
{
Write-Error $Error[0]
return
}
}
until (!$result)
}
else
{
try
{
$URI = "https://api.newrelic.com/v2/applications/$ApplicationID/deployments.json?page=$PageNumber"
$response = Invoke-RestMethod -Uri $URI @RestParams | Select-Object -ExpandProperty applications
if(!$Raw)
{
$response = $response |
Select-Object -Property `
@{N="ID";E={$_.ID}},
@{N="Revision";E={$_.revision}},
@{N="ChangeLog";E={$_.changelog}},
@{N="Description";E={$_.description}},
@{N="User";E={$_.user}},
@{N="Timestamp";E={[datetime]$_.timestamp}},
@{N="ApplicationID";E={$_.links.application}},
@{N="ApplicationName";E={if($ApplicationName){$ApplicationName}}}
}
}
catch
{
Write-Error $Error[0]
return
}
}
return $response
}
|
PowerShellCorpus/PowerShellGallery/PSNewRelic/0.8.4/Public/Get-NewRelicSyntheticsSLAReport.ps1
|
Get-NewRelicSyntheticsSLAReport.ps1
|
function Get-NewRelicSyntheticsSLAReport {
[cmdletbinding(DefaultParameterSetName="Weeks")]
Param
(
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]
$MonitorName,
[parameter(Mandatory=$false,ParameterSetName="Weeks")]
[ValidateNotNullOrEmpty()]
[int]
$CountOfWeeks = 1,
[parameter(Mandatory=$false,ParameterSetName="Days")]
[ValidateNotNullOrEmpty()]
[int]
$CountOfDays = 1,
[parameter(Mandatory=$false)]
[switch]
$Raw,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[String]
$InsightsQueryKey=$Script:PSNewRelic.InsightsQueryKey,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[String]
$AccountID=$Script:PSNewRelic.AccountID
)
if ($CountOfWeeks)
{
$Count = $CountOfWeeks
$Period = "week"
}
if ($CountOfDays)
{
$Count = $CountOfDays
$Period = "day"
}
if ($Count -gt 1)
{
$Period += "s"
}
$insightsQuery = "SELECT average(duration), apdex(duration, 7000), percentage(count(*), WHERE result='SUCCESS') FROM SyntheticCheck FACET dateOf(timestamp) SINCE $Count $Period ago WHERE monitorName='$MonitorName'"
if ($CountOfWeeks)
{
$insightsQuery += " LIMIT $(($CountOfWeeks * 7) +1)"
}
$response = Invoke-NewRelicInsightsQuery -InsightsQuery $insightsQuery
if ($Raw)
{
return $response
}
else
{
$formatted = @()
foreach ($item in $response.facets)
{
$formatted += $item |
Select-Object @{N="date";E={Get-Date $_.name -Format d}},
@{N="duration (ms)";E={$_.results[0].average}},
@{N="apdex";E={$_.results[1].score}},
@{N="# satisfied";E={$_.results[1].s}},
@{N="# tolerating";E={$_.results[1].t}},
@{N="# frustrated";E={$_.results[1].f}},
@{N="# total";E={$_.results[1].count}},
@{N="% uptime";E={$_.results[2].result}}
}
return $formatted | sort date
}
}
|
PowerShellCorpus/PowerShellGallery/PSNewRelic/0.8.4/Public/Invoke-NRQLQuery.ps1
|
Invoke-NRQLQuery.ps1
|
function Invoke-NRQLQuery {
[cmdletbinding(DefaultParameterSetName="Query")]
Param
(
[parameter(Mandatory=$false)]
[ValidateSet("Insert","Query")]
[string]
$Type="Query",
[parameter(Mandatory=$true,ParameterSetName="Query")]
[ValidateNotNullOrEmpty()]
[string]
$Query,
[parameter(Mandatory=$true,ParameterSetName="Insert")]
[ValidateScript({if([string]::IsNullOrWhiteSpace("$($_.eventType)")){throw "The ObjectsToInsert parameter requires a property of 'eventType' on all objects, as this is how New Relic Insights categorizes them."}else{$true}})]
[object[]]
$ObjectsToInsert,
[parameter(Mandatory=$false)]
[switch]
$Raw,
[parameter(Mandatory=$false,ParameterSetName="Query")]
[ValidateNotNullOrEmpty()]
[String]
$InsightsQueryKey=$Script:PSNewRelic.InsightsQueryKey,
[parameter(Mandatory=$false,ParameterSetName="Insert")]
[ValidateNotNullOrEmpty()]
[String]
$InsightsInsertKey=$Script:PSNewRelic.InsightsInsertKey,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[String]
$AccountID=$Script:PSNewRelic.AccountID
)
if ($Type -eq "Query")
{
$headers = @{
"X-Query-Key" = $InsightsQueryKey
}
$RestParams=@{
Method = "Get"
ContentType = "application/json"
Headers = $headers
}
$URI = "https://insights-api.newrelic.com/v1/accounts/$AccountID/query?nrql=$InsightsQuery"
}
elseif ($Type -eq "Insert")
{
$headers = @{
"X-Insert-Key" = $InsightsInsertKey
}
$body = $($ObjectsToInsert | ConvertTo-Json -Depth 2)
$RestParams=@{
Method = "Post"
ContentType = "application/json"
Headers = $headers
Body = $body
}
$URI = "https://insights-collector.newrelic.com/v1/accounts/$AccountID/events"
}
try
{
$response = Invoke-RestMethod -Uri $URI @RestParams
}
catch
{
Write-Error $Error[0].Exception.Message
return
}
return $response
}
|
PowerShellCorpus/PowerShellGallery/PSNewRelic/0.8.4/Public/Get-PSNewRelicConfig.ps1
|
Get-PSNewRelicConfig.ps1
|
Function Get-PSNewRelicConfig {
[cmdletbinding(DefaultParameterSetName = 'source')]
param(
[parameter(ParameterSetName='source')]
[ValidateSet("PSNewRelic","PSNewRelic.xml")]
$Source = "PSNewRelic",
[parameter(ParameterSetName='path')]
[parameter(ParameterSetName='source')]
$Path = "$ModuleRoot\$env:USERNAME-$env:COMPUTERNAME-PSNewRelic.xml"
)
if($PSCmdlet.ParameterSetName -eq 'source' -and $Source -eq "PSNewRelic" -and -not $PSBoundParameters.ContainsKey('Path'))
{
$Script:PSNewRelic
}
else
{
function Decrypt {
param($String)
if($String -is [System.Security.SecureString])
{
[System.Runtime.InteropServices.marshal]::PtrToStringAuto(
[System.Runtime.InteropServices.marshal]::SecureStringToBSTR(
$string))
}
}
Import-Clixml -Path $Path | Select -Property @{N="AccountID";E={Decrypt $_.AccountID}},@{N='APIKey';E={Decrypt $_.APIKey}},@{N='AdminAPIKey';E={Decrypt $_.AdminAPIKey}},@{N='InsightsInsertKey';E={Decrypt $_.InsightsInsertKey}},@{N='InsightsQueryKey';E={Decrypt $_.InsightsQueryKey}}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Single Server/SharePoint.ps1
|
SharePoint.ps1
|
Configuration Example
{
param (
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $FarmAccount,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $SPSetupAccount,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $WebPoolManagedAccount,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $ServicePoolManagedAccount,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $Passphrase
)
Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName SharePointDsc
node "localhost"
{
#**********************************************************
# Install Binaries
#
# This section installs SharePoint and its Prerequisites
#**********************************************************
SPInstallPrereqs InstallPrereqs {
Ensure = "Present"
InstallerPath = "C:\binaries\prerequisiteinstaller.exe"
OnlineMode = $true
}
SPInstall InstallSharePoint {
Ensure = "Present"
BinaryDir = "C:\binaries\"
ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
DependsOn = "[SPInstallPrereqs]InstallPrereqs"
}
#**********************************************************
# Basic farm configuration
#
# This section creates the new SharePoint farm object, and
# provisions generic services and components used by the
# whole farm
#**********************************************************
SPFarm CreateSPFarm
{
Ensure = "Present"
DatabaseServer = "sql.contoso.com"
FarmConfigDatabaseName = "SP_Config"
Passphrase = $Passphrase
FarmAccount = $FarmAccount
PsDscRunAsCredential = $SPSetupAccount
AdminContentDatabaseName = "SP_AdminContent"
RunCentralAdmin = $true
DependsOn = "[SPInstall]InstallSharePoint"
}
SPManagedAccount ServicePoolManagedAccount
{
AccountName = $ServicePoolManagedAccount.UserName
Account = $ServicePoolManagedAccount
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPManagedAccount WebPoolManagedAccount
{
AccountName = $WebPoolManagedAccount.UserName
Account = $WebPoolManagedAccount
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPDiagnosticLoggingSettings ApplyDiagnosticLogSettings
{
PsDscRunAsCredential = $SPSetupAccount
LogPath = "C:\ULS"
LogSpaceInGB = 5
AppAnalyticsAutomaticUploadEnabled = $false
CustomerExperienceImprovementProgramEnabled = $true
DaysToKeepLogs = 7
DownloadErrorReportingUpdatesEnabled = $false
ErrorReportingAutomaticUploadEnabled = $false
ErrorReportingEnabled = $false
EventLogFloodProtectionEnabled = $true
EventLogFloodProtectionNotifyInterval = 5
EventLogFloodProtectionQuietPeriod = 2
EventLogFloodProtectionThreshold = 5
EventLogFloodProtectionTriggerPeriod = 2
LogCutInterval = 15
LogMaxDiskSpaceUsageEnabled = $true
ScriptErrorReportingDelay = 30
ScriptErrorReportingEnabled = $true
ScriptErrorReportingRequireAuth = $true
DependsOn = "[SPFarm]CreateSPFarm"
}
SPUsageApplication UsageApplication
{
Name = "Usage Service Application"
DatabaseName = "SP_Usage"
UsageLogCutTime = 5
UsageLogLocation = "C:\UsageLogs"
UsageLogMaxFileSizeKB = 1024
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPStateServiceApp StateServiceApp
{
Name = "State Service Application"
DatabaseName = "SP_State"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPDistributedCacheService EnableDistributedCache
{
Name = "AppFabricCachingService"
Ensure = "Present"
CacheSizeInMB = 1024
ServiceAccount = $ServicePoolManagedAccount.UserName
PsDscRunAsCredential = $SPSetupAccount
CreateFirewallRules = $true
DependsOn = @('[SPFarm]CreateSPFarm','[SPManagedAccount]ServicePoolManagedAccount')
}
#**********************************************************
# Web applications
#
# This section creates the web applications in the
# SharePoint farm, as well as managed paths and other web
# application settings
#**********************************************************
SPWebApplication SharePointSites
{
Name = "SharePoint Sites"
ApplicationPool = "SharePoint Sites"
ApplicationPoolAccount = $WebPoolManagedAccount.UserName
AllowAnonymous = $false
AuthenticationMethod = "NTLM"
DatabaseName = "SP_Content"
Url = "http://sites.contoso.com"
HostHeader = "sites.contoso.com"
Port = 80
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPManagedAccount]WebPoolManagedAccount"
}
SPCacheAccounts WebAppCacheAccounts
{
WebAppUrl = "http://sites.contoso.com"
SuperUserAlias = "CONTOSO\SP_SuperUser"
SuperReaderAlias = "CONTOSO\SP_SuperReader"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPWebApplication]SharePointSites"
}
SPSite TeamSite
{
Url = "http://sites.contoso.com"
OwnerAlias = "CONTOSO\SP_Admin"
Name = "DSC Demo Site"
Template = "STS#0"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPWebApplication]SharePointSites"
}
#**********************************************************
# Service instances
#
# This section describes which services should be running
# and not running on the server
#**********************************************************
SPServiceInstance ClaimsToWindowsTokenServiceInstance
{
Name = "Claims to Windows Token Service"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPServiceInstance SecureStoreServiceInstance
{
Name = "Secure Store Service"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPServiceInstance ManagedMetadataServiceInstance
{
Name = "Managed Metadata Web Service"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPServiceInstance BCSServiceInstance
{
Name = "Business Data Connectivity Service"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPServiceInstance SearchServiceInstance
{
Name = "SharePoint Server Search"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
#**********************************************************
# Service applications
#
# This section creates service applications and required
# dependencies
#**********************************************************
$serviceAppPoolName = "SharePoint Service Applications"
SPServiceAppPool MainServiceAppPool
{
Name = $serviceAppPoolName
ServiceAccount = $ServicePoolManagedAccount.UserName
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPSecureStoreServiceApp SecureStoreServiceApp
{
Name = "Secure Store Service Application"
ApplicationPool = $serviceAppPoolName
AuditingEnabled = $true
AuditlogMaxSize = 30
DatabaseName = "SP_SecureStore"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPServiceAppPool]MainServiceAppPool"
}
SPManagedMetaDataServiceApp ManagedMetadataServiceApp
{
Name = "Managed Metadata Service Application"
PsDscRunAsCredential = $SPSetupAccount
ApplicationPool = $serviceAppPoolName
DatabaseName = "SP_MMS"
DependsOn = "[SPServiceAppPool]MainServiceAppPool"
}
SPBCSServiceApp BCSServiceApp
{
Name = "BCS Service Application"
ApplicationPool = $serviceAppPoolName
DatabaseName = "SP_BCS"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = @('[SPServiceAppPool]MainServiceAppPool', '[SPSecureStoreServiceApp]SecureStoreServiceApp')
}
SPSearchServiceApp SearchServiceApp
{
Name = "Search Service Application"
DatabaseName = "SP_Search"
ApplicationPool = $serviceAppPoolName
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPServiceAppPool]MainServiceAppPool"
}
#**********************************************************
# Local configuration manager settings
#
# This section contains settings for the LCM of the host
# that this configuraiton is applied to
#**********************************************************
LocalConfigurationManager
{
RebootNodeIfNeeded = $true
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Small Farm/SharePoint.ps1
|
SharePoint.ps1
|
$ConfigurationData = @{
AllNodes = @(
@{
NodeName = 'Server1'
PSDscAllowPlainTextPassword = $true
},
@{
NodeName = 'Server2'
PSDscAllowPlainTextPassword = $true
}
)
}
Configuration Example
{
param (
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $FarmAccount,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $SPSetupAccount,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $WebPoolManagedAccount,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $ServicePoolManagedAccount,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $Passphrase
)
Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName SharePointDsc
node "Server1"
{
#**********************************************************
# Install Binaries
#
# This section installs SharePoint and its Prerequisites
#**********************************************************
SPInstallPrereqs InstallPrereqs {
Ensure = "Present"
InstallerPath = "C:\binaries\prerequisiteinstaller.exe"
OnlineMode = $true
}
SPInstall InstallSharePoint {
Ensure = "Present"
BinaryDir = "C:\binaries\"
ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
DependsOn = "[SPInstallPrereqs]InstallPrereqs"
}
#**********************************************************
# Basic farm configuration
#
# This section creates the new SharePoint farm object, and
# provisions generic services and components used by the
# whole farm
#**********************************************************
SPFarm CreateSPFarm
{
Ensure = "Present"
DatabaseServer = "sql.contoso.com"
FarmConfigDatabaseName = "SP_Config"
Passphrase = $Passphrase
FarmAccount = $FarmAccount
PsDscRunAsCredential = $SPSetupAccount
AdminContentDatabaseName = "SP_AdminContent"
RunCentralAdmin = $true
DependsOn = "[SPInstall]InstallSharePoint"
}
SPManagedAccount ServicePoolManagedAccount
{
AccountName = $ServicePoolManagedAccount.UserName
Account = $ServicePoolManagedAccount
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPManagedAccount WebPoolManagedAccount
{
AccountName = $WebPoolManagedAccount.UserName
Account = $WebPoolManagedAccount
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPDiagnosticLoggingSettings ApplyDiagnosticLogSettings
{
PsDscRunAsCredential = $SPSetupAccount
LogPath = "C:\ULS"
LogSpaceInGB = 5
AppAnalyticsAutomaticUploadEnabled = $false
CustomerExperienceImprovementProgramEnabled = $true
DaysToKeepLogs = 7
DownloadErrorReportingUpdatesEnabled = $false
ErrorReportingAutomaticUploadEnabled = $false
ErrorReportingEnabled = $false
EventLogFloodProtectionEnabled = $true
EventLogFloodProtectionNotifyInterval = 5
EventLogFloodProtectionQuietPeriod = 2
EventLogFloodProtectionThreshold = 5
EventLogFloodProtectionTriggerPeriod = 2
LogCutInterval = 15
LogMaxDiskSpaceUsageEnabled = $true
ScriptErrorReportingDelay = 30
ScriptErrorReportingEnabled = $true
ScriptErrorReportingRequireAuth = $true
DependsOn = "[SPFarm]CreateSPFarm"
}
SPUsageApplication UsageApplication
{
Name = "Usage Service Application"
DatabaseName = "SP_Usage"
UsageLogCutTime = 5
UsageLogLocation = "C:\UsageLogs"
UsageLogMaxFileSizeKB = 1024
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPStateServiceApp StateServiceApp
{
Name = "State Service Application"
DatabaseName = "SP_State"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPDistributedCacheService EnableDistributedCache
{
Name = "AppFabricCachingService"
Ensure = "Present"
CacheSizeInMB = 1024
ServiceAccount = $ServicePoolManagedAccount.UserName
PsDscRunAsCredential = $SPSetupAccount
CreateFirewallRules = $true
DependsOn = @('[SPFarm]CreateSPFarm','[SPManagedAccount]ServicePoolManagedAccount')
}
#**********************************************************
# Web applications
#
# This section creates the web applications in the
# SharePoint farm, as well as managed paths and other web
# application settings
#**********************************************************
SPWebApplication SharePointSites
{
Name = "SharePoint Sites"
ApplicationPool = "SharePoint Sites"
ApplicationPoolAccount = $WebPoolManagedAccount.UserName
AllowAnonymous = $false
AuthenticationMethod = "NTLM"
DatabaseName = "SP_Content"
Url = "http://sites.contoso.com"
HostHeader = "sites.contoso.com"
Port = 80
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPManagedAccount]WebPoolManagedAccount"
}
SPCacheAccounts WebAppCacheAccounts
{
WebAppUrl = "http://sites.contoso.com"
SuperUserAlias = "CONTOSO\SP_SuperUser"
SuperReaderAlias = "CONTOSO\SP_SuperReader"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPWebApplication]SharePointSites"
}
SPSite TeamSite
{
Url = "http://sites.contoso.com"
OwnerAlias = "CONTOSO\SP_Admin"
Name = "DSC Demo Site"
Template = "STS#0"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPWebApplication]SharePointSites"
}
#**********************************************************
# Service instances
#
# This section describes which services should be running
# and not running on the server
#**********************************************************
SPServiceInstance ClaimsToWindowsTokenServiceInstance
{
Name = "Claims to Windows Token Service"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPServiceInstance SecureStoreServiceInstance
{
Name = "Secure Store Service"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPServiceInstance SearchServiceInstance
{
Name = "SharePoint Server Search"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
#**********************************************************
# Service applications
#
# This section creates service applications and required
# dependencies
#**********************************************************
$serviceAppPoolName = "SharePoint Service Applications"
SPServiceAppPool MainServiceAppPool
{
Name = $serviceAppPoolName
ServiceAccount = $ServicePoolManagedAccount.UserName
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]CreateSPFarm"
}
SPSecureStoreServiceApp SecureStoreServiceApp
{
Name = "Secure Store Service Application"
ApplicationPool = $serviceAppPoolName
AuditingEnabled = $true
AuditlogMaxSize = 30
DatabaseName = "SP_SecureStore"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPServiceAppPool]MainServiceAppPool"
}
SPManagedMetaDataServiceApp ManagedMetadataServiceApp
{
Name = "Managed Metadata Service Application"
PsDscRunAsCredential = $SPSetupAccount
ApplicationPool = $serviceAppPoolName
DatabaseName = "SP_MMS"
DependsOn = "[SPServiceAppPool]MainServiceAppPool"
}
SPBCSServiceApp BCSServiceApp
{
Name = "BCS Service Application"
ApplicationPool = $serviceAppPoolName
DatabaseName = "SP_BCS"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = @('[SPServiceAppPool]MainServiceAppPool', '[SPSecureStoreServiceApp]SecureStoreServiceApp')
}
SPSearchServiceApp SearchServiceApp
{
Name = "Search Service Application"
DatabaseName = "SP_Search"
ApplicationPool = $serviceAppPoolName
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPServiceAppPool]MainServiceAppPool"
}
#**********************************************************
# Local configuration manager settings
#
# This section contains settings for the LCM of the host
# that this configuraiton is applied to
#**********************************************************
LocalConfigurationManager
{
RebootNodeIfNeeded = $true
}
}
node "Server2"
{
#**********************************************************
# Install Binaries
#
# This section installs SharePoint and its Prerequisites
#**********************************************************
SPInstallPrereqs InstallPrereqs {
Ensure = "Present"
InstallerPath = "C:\binaries\prerequisiteinstaller.exe"
OnlineMode = $true
}
SPInstall InstallSharePoint {
Ensure = "Present"
BinaryDir = "C:\binaries\"
ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
DependsOn = "[SPInstallPrereqs]InstallPrereqs"
}
#**********************************************************
# Basic farm configuration
#
# This section creates the new SharePoint farm object, and
# provisions generic services and components used by the
# whole farm
#**********************************************************
SPFarm JoinSPFarm
{
Ensure = "Present"
DatabaseServer = "sql.contoso.com"
FarmConfigDatabaseName = "SP_Config"
Passphrase = $Passphrase
FarmAccount = $FarmAccount
PsDscRunAsCredential = $SPSetupAccount
AdminContentDatabaseName = "SP_AdminContent"
RunCentralAdmin = $false
DependsOn = "[SPInstall]InstallSharePoint"
}
SPDistributedCacheService EnableDistributedCache
{
Name = "AppFabricCachingService"
Ensure = "Present"
CacheSizeInMB = 1024
ServiceAccount = $ServicePoolManagedAccount.UserName
PsDscRunAsCredential = $SPSetupAccount
CreateFirewallRules = $true
DependsOn = "[SPFarm]JoinSPFarm"
}
#**********************************************************
# Service instances
#
# This section describes which services should be running
# and not running on the server
#**********************************************************
SPServiceInstance ClaimsToWindowsTokenServiceInstance
{
Name = "Claims to Windows Token Service"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]JoinSPFarm"
}
SPServiceInstance ManagedMetadataServiceInstance
{
Name = "Managed Metadata Web Service"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]JoinSPFarm"
}
SPServiceInstance BCSServiceInstance
{
Name = "Business Data Connectivity Service"
Ensure = "Present"
PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[SPFarm]JoinSPFarm"
}
#**********************************************************
# Local configuration manager settings
#
# This section contains settings for the LCM of the host
# that this configuraiton is applied to
#**********************************************************
LocalConfigurationManager
{
RebootNodeIfNeeded = $true
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPWebAppBlockedFileTypes/2-SpecificList.ps1
|
2-SpecificList.ps1
|
<#
.EXAMPLE
This example shows how to ensure that the blocked file type list always
specifically matches this list.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPWebAppBlockedFileTypes PrimaryWebAppBlockedFileTypes
{
Url = "http://exmaple.contoso.local"
Blocked = @("exe", "dll", "msi")
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPWebAppBlockedFileTypes/1-Inclusion.ps1
|
1-Inclusion.ps1
|
<#
.EXAMPLE
This example shows how to ensure that specific file types are always blocked while
others will always be allowed. Any file types not mentioned in this config will be
able to be managed manually.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPWebAppBlockedFileTypes PrimaryWebAppBlockedFileTypes
{
Url = "http://exmaple.contoso.local"
EnsureBlocked = @("exe", "dll", "msi")
EnsureAllowed = @("pdf", "docx", "xlsx")
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPWebAppGeneralSettings/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example shows how to apply some of the available general settings to the
specified web app
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPWebAppGeneralSettings PrimaryWebAppGeneralSettings
{
Url = "http://exmaple.contoso.local"
TimeZone = 76
Alerts = $true
RSS = $false
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPStateServiceApp/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example creates a state service application in the local farm
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPStateServiceApp StateServiceApp
{
Name = "State Service Application"
DatabaseName = "SP_State"
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPPublishServiceApplication/2-UnpublishServiceApplication.ps1
|
2-UnpublishServiceApplication.ps1
|
<#
.EXAMPLE
This example shows how to ensure that the Secure Store Service is not
published within the farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPPublishServiceApplication UnpublishSecureStoreServiceApp
{
Name = "Secure Store Service Application"
Ensure = "Absent"
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPPublishServiceApplication/1-PublishServiceApplication.ps1
|
1-PublishServiceApplication.ps1
|
<#
.EXAMPLE
This example shows how to ensure that the managed metadata service is published
within the farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPPublishServiceApplication PublishManagedMetadataServiceApp
{
Name = "Managed Metadata Service Application"
Ensure = "Present"
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPWorkManagementServiceApp/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example creates a new work management service app in the local farm
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPWorkManagementServiceApp WorkManagementServiceApp
{
Name = "Work Management Service Application"
ApplicationPool = "SharePoint web services"
MinimumTimeBetweenEwsSyncSubscriptionSearches = 10
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPAppStoreSettings/1-EnableSharePointAppStore.ps1
|
1-EnableSharePointAppStore.ps1
|
<#
.EXAMPLE
This example shows how to configure the AppCatalog in the farm
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPAppStoreSettings EnableSharePointAppStore
{
WebAppUrl = "https://sharepoint.contoso.com"
AllowAppPurchases = $true
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPAppStoreSettings/2-EnableAppStores.ps1
|
2-EnableAppStores.ps1
|
<#
.EXAMPLE
This example shows how to configure the AppCatalog in the farm
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPAppStoreSettings EnableAppStores
{
WebAppUrl = "https://sharepoint.contoso.com"
AllowAppPurchases = $true
AllowAppsForOffice = $true
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPAppStoreSettings/3-DisableAppStores.ps1
|
3-DisableAppStores.ps1
|
<#
.EXAMPLE
This example shows how to configure the AppCatalog in the farm
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPAppStoreSettings DisableAppStores
{
WebAppUrl = "https://sharepoint.contoso.com"
AllowAppPurchases = $false
AllowAppsForOffice = $false
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSearchContentSource/2-WebsiteSource.ps1
|
2-WebsiteSource.ps1
|
<#
.EXAMPLE
This example shows how to create a website content source
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSearchContentSource WebsiteSource
{
Name = "Contoso website"
ServiceAppName = "Search Service Application"
ContentSourceType = "Website"
Addresses = @("http://www.contoso.com")
CrawlSetting = "Custom"
LimitPageDepth = 5
LimitServerHops = 0
IncrementalSchedule = MSFT_SPSearchCrawlSchedule{
ScheduleType = "Daily"
StartHour = "0"
StartMinute = "0"
CrawlScheduleRepeatDuration = "1440"
CrawlScheduleRepeatInterval = "5"
}
FullSchedule = MSFT_SPSearchCrawlSchedule{
ScheduleType = "Weekly"
CrawlScheduleDaysOfWeek = @("Monday", "Wednesday", "Friday")
StartHour = "3"
StartMinute = "0"
}
Priority = "Normal"
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSearchContentSource/1-SharePointSource.ps1
|
1-SharePointSource.ps1
|
<#
.EXAMPLE
This example shows how to create a SharePoint sites content source
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSearchContentSource LocalSharePointSites
{
Name = "Local SharePoint Sites"
ServiceAppName = "Search Service Application"
ContentSourceType = "SharePoint"
Addresses = @("http://sharepointsite1.contoso.com", "http://sharepointsite2.contoso.com")
CrawlSetting = "CrawlEverything"
ContinuousCrawl = $true
IncrementalSchedule = MSFT_SPSearchCrawlSchedule {
ScheduleType = "Daily"
StartHour = "0"
StartMinute = "0"
CrawlScheduleRepeatDuration = "1440"
CrawlScheduleRepeatInterval = "5"
}
FullSchedule = $null
Priority = "Normal"
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPFeature/2-DisableFeature.ps1
|
2-DisableFeature.ps1
|
<#
.EXAMPLE
This example shows how to disable a site collection scoped feature
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPFeature EnableViewFormsLockDown
{
Name = "ViewFormPagesLockDown"
Url = "http://www.contoso.com"
FeatureScope = "Site"
Ensure = "Absent"
PsDscRunAsCredential = $SetupAccount
Version = "1.0.0.0"
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPFeature/1-EnableFeature.ps1
|
1-EnableFeature.ps1
|
<#
.EXAMPLE
This example shows how to enable a site collection scoped feature
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPFeature EnableViewFormsLockDown
{
Name = "ViewFormPagesLockDown"
Url = "http://www.contoso.com"
FeatureScope = "Site"
PsDscRunAsCredential = $SetupAccount
Version = "1.0.0.0"
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPWeb/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example deploys a subsite in a specific location
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPWeb TeamSite
{
Url = "http://sharepoint.contoso.com/sites/site/subweb"
Name = "Team Sites"
Ensure = "Present"
Description = "A place to share documents with your team."
Template = "STS#0"
Language = 1033
AddToTopNav = $true
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPWebApplicationExtension/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example shows how to create a new web application extension in the local farm
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPWebApplicationExtension IntranetZone
{
WebAppUrl = "http://example.contoso.local"
Name = "Contoso Intranet Zone"
AllowAnonymous = $false
AuthenticationMethod = "NTLM"
Url = "http://intranet.contoso.local"
Zone = "Intranet"
HostHeader = "intranet.contoso.local"
Path = "c:\inetpub\wwwroot\wss\VirtualDirectories\intranet"
UseSSL = $false
Port = 80
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSearchFileType/2-DisableFileType.ps1
|
2-DisableFileType.ps1
|
<#
.EXAMPLE
This example shows how to disable a specific file type in search
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSearchFileType PDF
{
FileType = "pdf"
ServiceAppName = "Search Service Application"
Description = "PDF"
MimeType = "application/pdf"
Enabled = $false
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSearchFileType/1-EnsureFileType.ps1
|
1-EnsureFileType.ps1
|
<#
.EXAMPLE
This example shows how to apply settings to a specific file type in search, using the required parameters
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSearchFileType PDF
{
FileType = "pdf"
ServiceAppName = "Search Service Application"
Description = "PDF"
MimeType = "application/pdf"
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPWebApplicationAppDomain/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example shows how to set the app domain for a specified web application
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPWebApplicationAppDomain Domain
{
AppDomain = "contosointranetapps.com"
WebApplication ="http://portal.contoso.com";
Zone = "Default";
Port = 80;
SSL = $false;
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPWebAppProxyGroup/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example shows how to assign a specific proxy group to the specified web app
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPWebAppProxyGroup ContosoWeb
{
WebAppUrl = "https://web.contoso.com"
ServiceAppProxyGroup = "Proxy Group 1"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSearchCrawlRule/1-BasicExample.ps1
|
1-BasicExample.ps1
|
<#
.EXAMPLE
This example shows how to apply settings to a sepcific URL in search
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSearchCrawlRule IntranetCrawlAccount
{
Path = "https://intranet.sharepoint.contoso.com"
ServiceAppName = "Search Service Application"
Ensure = "Present"
RuleType = "InclusionRule"
CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP"
AuthenticationType = "DefaultRuleAccess"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSearchCrawlRule/2-CertificateExample.ps1
|
2-CertificateExample.ps1
|
<#
.EXAMPLE
This example shows how to set a certificate for authentication to a content source
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSearchCrawlRule IntranetCrawlAccountCertificate
{
Path = "https://intranet.sharepoint.contoso.com"
ServiceAppName = "Search Service Application"
Ensure = "Present"
RuleType = "InclusionRule"
CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP"
AuthenticationType = "CertificateRuleAccess"
CertificateName = "Certificate Name"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSite/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example creates a site collection with the provided details
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSite TeamSite
{
Url = "http://sharepoint.contoso.com"
OwnerAlias = "CONTOSO\ExampleUser"
HostHeaderWebApplication = "http://spsites.contoso.com"
Name = "Team Sites"
Template = "STS#0"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPAlternateUrl/2-RemoveAlternateUrl.ps1
|
2-RemoveAlternateUrl.ps1
|
<#
.EXAMPLE
This example shows how to remove an alternate URL from a specified zone for a specific
web application.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPAlternateUrl CentralAdminAAM
{
WebAppUrl = "http://sharepoint1:9999"
Zone = "Intranet"
Ensure = "Absent"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPAlternateUrl/1-CreateAlternateUrl.ps1
|
1-CreateAlternateUrl.ps1
|
<#
.EXAMPLE
This example shows how to add a new alternate URL to a specific web application
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPAlternateUrl CentralAdminAAM
{
WebAppUrl = "http://sharepoint1:9999"
Zone = "Intranet"
Url = "https://admin.sharepoint.contoso.com"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPWebAppPolicy/1-SpecificMembers.ps1
|
1-SpecificMembers.ps1
|
<#
.EXAMPLE
This example sets the specific web app policy for the specified web app to
match the provided list below.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPWebAppPolicy WebAppPolicy
{
WebAppUrl = "http://sharepoint.contoso.com"
Members = @(
MSFT_SPWebPolicyPermissions {
Username = "contoso\user1"
PermissionLevel = "Full Control"
ActAsSystemAccount = $true
}
MSFT_SPWebPolicyPermissions {
Username = "contoso\Group 1"
PermissionLevel = "Full Read"
IdentityType = "Claims"
}
)
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPWebAppPolicy/2-IncludeMembers.ps1
|
2-IncludeMembers.ps1
|
<#
.EXAMPLE
This example shows how to include specific members while excluding other members
from the policy of the web app.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPWebAppPolicy WebAppPolicy
{
WebAppUrl = "http://sharepoint.contoso.com"
MembersToInclude = @(
@(MSFT_SPWebPolicyPermissions {
Username = "contoso\user1"
PermissionLevel = "Full Control"
})
@(MSFT_SPWebPolicyPermissions {
Username = "contoso\user2"
PermissionLevel = "Full Read"
})
)
MembersToExclude = @(
@(MSFT_SPWebPolicyPermissions {
Username = "contoso\user3"
})
)
SetCacheAccountsPolicy = $true
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPPasswordChangeSettings/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example sets the password change settings for managed accounts in the local farm
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPPasswordChangeSettings ManagedAccountPasswordResetSettings
{
MailAddress = "sharepoint`@contoso.com"
DaysBeforeExpiry = "14"
PasswordChangeWaitTimeSeconds = "60"
NumberOfRetries = "3"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPDesignerSettings/1-ApplyDesignerConfig.ps1
|
1-ApplyDesignerConfig.ps1
|
<#
.EXAMPLE
This example applies settings to disable SharePoint Designer access to the
specified web application.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPDesignerSettings MainWebAppSPDSettings
{
Url = "https://intranet.sharepoint.contoso.com"
SettingsScope = "WebApplication"
AllowSharePointDesigner = $false
AllowDetachPagesFromDefinition = $false
AllowCustomiseMasterPage = $false
AllowManageSiteURLStructure = $false
AllowCreateDeclarativeWorkflow = $false
AllowSavePublishDeclarativeWorkflow = $false
AllowSaveDeclarativeWorkflowAsTemplate = $false
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPIrmSettings/1-ApplyIRMSConfig.ps1
|
1-ApplyIRMSConfig.ps1
|
<#
.EXAMPLE
This example shows how to apply the RMS settings to a local farm, pointing to
a specific RMS server
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPIrmSettings RMSSettings
{
Ensure = "Present"
RMSserver = "https://rms.contoso.com"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPMachineTranslationServiceApp/1-CreateServiceApp.ps1
|
1-CreateServiceApp.ps1
|
<#
.EXAMPLE
This example shows how to deploy the SP Machine Translation Service App to the local SharePoint farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPMachineTranslationServiceApp MachineTranslationServiceApp
{
Name = "Translation Service Application"
ApplicationPool = "SharePoint Service Applications"
DatabaseServer = "SQL.contoso.local"
DatabaseName = "Translation"
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPMachineTranslationServiceApp/2-RemoveServiceApp.ps1
|
2-RemoveServiceApp.ps1
|
<#
.EXAMPLE
This example shows how to remove the SP Machine Translation Service App to the local SharePoint farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPMachineTranslationServiceApp MachineTranslationServiceApp
{
Name = "Translation Service Application"
ApplicationPool = "SharePoint Service Applications"
DatabaseServer = "SQL.contoso.local"
DatabaseName = "Translation"
Ensure = "Absent"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPPowerPointAutomationServiceApp/1-NewServiceApp.ps1
|
1-NewServiceApp.ps1
|
<#
.EXAMPLE
This example makes sure the service application exists and has a specific configuration
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPPowerPointAutomationServiceApp PowerPointAutomation
{
Name = "PowerPoint Automation Service Application"
ProxyName = "PowerPoint Automation Service Application Proxy"
CacheExpirationPeriodInSeconds = 600
MaximumConversionsPerWorker = 5
WorkerKeepAliveTimeoutInSeconds = 120
WorkerProcessCount = 3
WorkerTimeoutInSeconds = 300
ApplicationPool = "SharePoint Web Services"
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPPowerPointAutomationServiceApp/2-RemoveServiceApp.ps1
|
2-RemoveServiceApp.ps1
|
<#
.EXAMPLE
This example removes a word automation service app
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPPowerPointAutomationServiceApp WordAutomation
{
Name = "PowerPoint Automation Service Application"
Ensure = "Absent"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSearchAuthoritativePage/2 - DemotedPage.ps1
|
2 - DemotedPage.ps1
|
<#
.EXAMPLE
This example shows how to create a Search Demoted Page
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSearchAuthoritativePage AuthoratativePage
{
ServiceAppName = "Search Service Application"
Path = "http://site.sharepoint.com/Pages/demoted.aspx"
Action = "Demoted"
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSearchAuthoritativePage/1 - AuthoritativePage.ps1
|
1 - AuthoritativePage.ps1
|
<#
.EXAMPLE
This example shows how to create a Search Authoritative Page
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSearchAuthoritativePage AuthoratativePage
{
ServiceAppName = "Search Service Application"
Path = "http://site.sharepoint.com/Pages/authoritative.aspx"
Action = "Authoratative"
Level = 0.0
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPContentDatabase/1-AddContentDatabase.ps1
|
1-AddContentDatabase.ps1
|
<#
.EXAMPLE
This example creates a new content database for the specified web application.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPContentDatabase ContentDB
{
Name = "SharePoint_Content_01"
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
WebAppUrl = "http://sharepoint.contoso.com"
Enabled = $true
WarningSiteCount = 2000
MaximumSiteCount = 5000
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPContentDatabase/2-RemoveContentDatabase.ps1
|
2-RemoveContentDatabase.ps1
|
<#
.EXAMPLE
This example dismounts a content database from the specified web application. This
will not remove the database from SQL server however, only taking it out of the
web applications configuration.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPContentDatabase ContentDB
{
Name = "SharePoint_Content_01"
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
WebAppUrl = "http://sharepoint.contoso.com"
Ensure = "Absent"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPAccessServiceApp/1-CreateServiceApp.ps1
|
1-CreateServiceApp.ps1
|
<#
.EXAMPLE
This example shows how to deploy Access Services 2013 to the local SharePoint farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPAccessServiceApp AccessServices
{
Name = "Access Services Service Application"
ApplicationPool = "SharePoint Service Applications"
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPAccessServiceApp/2-RemoveServiceApp.ps1
|
2-RemoveServiceApp.ps1
|
<#
.EXAMPLE
This example shows how to remove a specific Access Services 2013 from the local
SharePoint farm. Because Application pool and database server are both required
parameters, but are not acutally needed to remove the app, any text value can
be supplied for these as they will be ignored.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPAccessServiceApp AccessServices
{
Name = "Access Services Service Application"
ApplicationPool = "n/a"
DatabaseServer = "n/a"
Ensure = "Absent"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPPerformancePointServiceApp/1-RemoveServiceApp.ps1
|
1-RemoveServiceApp.ps1
|
<#
.EXAMPLE
This example removes the specific performance point service app from the local
farm. The ApplicationPool parameter is still mandatory but it is not used, so
the value can be anything.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPPerformancePointServiceApp PerformancePoint
{
Name = "Performance Point Service Application"
ApplicationPool = "n/a"
Ensure = "Absent"
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPPerformancePointServiceApp/1-NewServiceApp.ps1
|
1-NewServiceApp.ps1
|
<#
.EXAMPLE
This example creates a new performance point service app in the local farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPPerformancePointServiceApp PerformancePoint
{
Name = "Performance Point Service Application"
ApplicationPool = "SharePoint Web Services"
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPServiceInstance/2-StopService.ps1
|
2-StopService.ps1
|
<#
.EXAMPLE
This example shows how to ensure that the Business Data Connectivity Service
is not running on the local server.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPServiceInstance StopBCSServiceInstance
{
Name = "Business Data Connectivity Service"
Ensure = "Absent"
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPServiceInstance/1-StartService.ps1
|
1-StartService.ps1
|
<#
.EXAMPLE
This example shows how to ensure that the managed metadata service is running
on the local server.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPServiceInstance ManagedMetadataServiceInstance
{
Name = "Managed Metadata Web Service"
Ensure = "Present"
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPExcelServiceApp/1-CreateServiceApp.ps1
|
1-CreateServiceApp.ps1
|
<#
.EXAMPLE
This example shows how to deploy Excel Services to the local SharePoint farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPExcelServiceApp ExcelServices
{
Name = "Excel Services Service Application"
ApplicationPool = "SharePoint Service Applications"
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPExcelServiceApp/2-RemoveServiceApp.ps1
|
2-RemoveServiceApp.ps1
|
<#
.EXAMPLE
This example shows how to remove Excel Services from the local SharePoint farm.
Here application pool is a required parameter, but it is not actually used when
removing a service app and as such can be ignored and set to any value.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPExcelServiceApp ExcelServices
{
Name = "Excel Services Service Application"
ApplicationPool = "n/a"
Ensure = "Absent"
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPUsageApplication/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example deploys a usage application to the local farm
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPUsageApplication UsageApplication
{
Name = "Usage Service Application"
DatabaseName = "SP_Usage"
UsageLogCutTime = 5
UsageLogLocation = "L:\UsageLogs"
UsageLogMaxFileSizeKB = 1024
Ensure = "Present"
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPOfficeOnlineServerBinding/1-AddBinding.ps1
|
1-AddBinding.ps1
|
<#
.EXAMPLE
This example shows how to create bindings to the internal-https zone for the
local SharePoint farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPOfficeOnlineServerBinding OosBinding
{
Zone = "internal-https"
DnsName = "webapps.contoso.com"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPOfficeOnlineServerBinding/2-RemoveBinding.ps1
|
2-RemoveBinding.ps1
|
<#
.EXAMPLE
This example shows how to remove bindings from the internal-http zone for the
local SharePoint farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPOfficeOnlineServerBinding OosBinding
{
Zone = "Internal-HTTP"
DnsName = "webapps.contoso.com"
PsDscRunAsCredential = $SetupAccount
Ensure = "Absent"
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPManagedAccount/1-NewManagedAccount.ps1
|
1-NewManagedAccount.ps1
|
<#
.EXAMPLE
This example shows how to create a new managed account in a local farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$ManagedAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPManagedAccount NewManagedAccount
{
AccountName = $ManagedAccount.UserName
Account = $ManagedAccount
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPManagedAccount/2-NewManagedAccountWithSchedule.ps1
|
2-NewManagedAccountWithSchedule.ps1
|
<#
.EXAMPLE
This example shows how to create a new managed account in a local farm, using
the automatic password change schedule
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$ManagedAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPManagedAccount NewManagedAccount
{
AccountName = $ManagedAccount.UserName
Account = $ManagedAccount
Ensure = "Present"
Schedule = "monthly between 7 02:00:00 and 7 03:00:00"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPFarmPropertyBag/1-RemoveFarmPropertyBag.ps1
|
1-RemoveFarmPropertyBag.ps1
|
<#
.EXAMPLE
This example shows how remove property bag in the current farm.
#>
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost
{
SPFarmPropertyBag APPLICATION_APPCodeProperty
{
PsDscRunAsCredential = $SetupAccount
Key = "KeyToRemove"
Ensure = "Absent"
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPFarmPropertyBag/1-AddFarmPropertyBag.ps1
|
1-AddFarmPropertyBag.ps1
|
<#
.EXAMPLE
This example shows how add property bag in the current farm.
#>
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost
{
SPFarmPropertyBag APPLICATION_APPCodeProperty
{
PsDscRunAsCredential = $SetupAccount
Key = "FARM_TYPE"
Value = "SearchFarm"
Ensure = "Present"
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSessionStateService/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example creates a new session state service on the local farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSessionStateService StateServiceApp
{
DatabaseName = "SP_StateService"
DatabaseServer = "SQL.test.domain"
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPCreateFarm/2-CreateCustomCentralAdmin.ps1
|
2-CreateCustomCentralAdmin.ps1
|
<#
.EXAMPLE
This example shows how a basic SharePoint farm can be created. The database server and names
are specified, and the accounts to run the setup as, the farm account and the passphrase are
all passed in to the configuration to be applied. Here the port for the central admin site to
run on, as well as the authentication mode for the site are also specified.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$FarmAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$Passphrase
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPCreateFarm CreateFarm
{
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
FarmConfigDatabaseName = "SP_Config"
AdminContentDatabaseName = "SP_AdminContent"
CentralAdministrationPort = 5000
CentralAdministrationAuth = "Kerberos"
Passphrase = $Passphrase
FarmAccount = $FarmAccount
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPCreateFarm/1-CreateBasicFarm.ps1
|
1-CreateBasicFarm.ps1
|
<#
.EXAMPLE
This example shows how a basic SharePoint farm can be created. The database server and names
are specified, and the accounts to run the setup as, the farm account and the passphrase are
all passed in to the configuration to be applied. By default the central admin site in this
example is provisioned to port 9999 using NTLM authentication.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$FarmAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$Passphrase
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPCreateFarm CreateFarm
{
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
FarmConfigDatabaseName = "SP_Config"
AdminContentDatabaseName = "SP_AdminContent"
Passphrase = $Passphrase
FarmAccount = $FarmAccount
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPCreateFarm/3-CreateFarmWithServerRole.ps1
|
3-CreateFarmWithServerRole.ps1
|
<#
.EXAMPLE
This example shows how a basic SharePoint farm can be created. The database server and names
are specified, and the accounts to run the setup as, the farm account and the passphrase are
all passed in to the configuration to be applied. By default the central admin site in this
example is provisioned to port 9999 using NTLM authentication. In this example we also see
the server role defined as "Application" which tells SharePoint 2016 the role to apply to
this server as soon as the farm is created. This property is not supported for SharePoint 2013
and so this specific example would fail if used against that verison.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$FarmAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$Passphrase
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPCreateFarm CreateFarm
{
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
FarmConfigDatabaseName = "SP_Config"
AdminContentDatabaseName = "SP_AdminContent"
ServerRole = "Application"
Passphrase = $Passphrase
FarmAccount = $FarmAccount
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPRemoteFarmTrust/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example creates a remote farm trust so that the local web app trusts calls
that will come from the remote web app.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPRemoteFarmTrust TrustRemoteFarmForSearch
{
Name = "CentralSearchFarm"
RemoteWebAppUrl = "https://search.sharepoint.contoso.com"
LocalWebAppUrl = "https://local.sharepoint2.contoso.com"
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPBCSServiceApp/1-CreateServiceApp.ps1
|
1-CreateServiceApp.ps1
|
<#
.EXAMPLE
This example shows how to deploy a Business Connectivity Services application to the
local SharePoint farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPBCSServiceApp BCSServiceApp
{
Name = "BCS Service Application"
ApplicationPool = "SharePoint Service Applications"
DatabaseName = "SP_BCS"
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPBCSServiceApp/2-RemoveServiceApp.ps1
|
2-RemoveServiceApp.ps1
|
<#
.EXAMPLE
This example shows how to deploy a Business Connectivity Services application to the
local SharePoint farm. The application pool account is mandatory but the value is
ignored when removing a service app, so the value entered here does not matter.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPBCSServiceApp BCSServiceApp
{
Name = "BCS Service Application"
ApplicationPool = "n/a"
Ensure = "Absent"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSearchTopology/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example shows how to apply a specific topology to the search service app
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSearchTopology LocalSearchTopology
{
ServiceAppName = "Search Service Application"
Admin = @("Server1","Server2")
Crawler = @("Server1","Server2")
ContentProcessing = @("Server1","Server2")
AnalyticsProcessing = @("Server1","Server2")
QueryProcessing = @("Server3","Server4")
PsDscRunAsCredential = $SetupAccount
FirstPartitionDirectory = "I:\SearchIndexes\0"
IndexPartition = @("Server3","Server4")
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPDistributedCacheService/3-MultiServerCache.ps1
|
3-MultiServerCache.ps1
|
<#
.EXAMPLE
This example applies the distributed cache service to both "server1" and
"server2". The ServerProvisionOrder will ensure that it applies it to
server1 first and then server2, making sure they don't both attempt to
create the cache at the same time, resuling in errors.
Note: Do not allow plain text passwords in production environments.
#>
$ConfigurationData = @{
AllNodes = @(
@{
NodeName = 'Server1'
PSDscAllowPlainTextPassword = $true
},
@{
NodeName = 'Server2'
PSDscAllowPlainTextPassword = $true
}
)
}
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node "Server1"
{
SPDistributedCacheService EnableDistributedCache
{
Name = "AppFabricCachingService"
CacheSizeInMB = 8192
ServiceAccount = "DEMO\ServiceAccount"
ServerProvisionOrder = @("Server1","Server2")
CreateFirewallRules = $true
InstallAccount = $SetupAccount
}
}
node "Server2"
{
SPDistributedCacheService EnableDistributedCache
{
Name = "AppFabricCachingService"
CacheSizeInMB = 8192
ServiceAccount = "DEMO\ServiceAccount"
ServerProvisionOrder = @("Server1","Server2")
CreateFirewallRules = $true
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPDistributedCacheService/1-SingleServerCache.ps1
|
1-SingleServerCache.ps1
|
<#
.EXAMPLE
This example applies the distributed cache service to the current server,
also setting the rules in Windows firewall to allow communication with
other cache hosts.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPDistributedCacheService EnableDistributedCache
{
Name = "AppFabricCachingService"
CacheSizeInMB = 8192
ServiceAccount = "DEMO\ServiceAccount"
InstallAccount = $SetupAccount
CreateFirewallRules = $true
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPDistributedCacheService/2-CacheNoFirewall.ps1
|
2-CacheNoFirewall.ps1
|
<#
.EXAMPLE
This example applies the distributed cache service to the current server,
but will not apply the rules to allow it to communicate with other cache
hosts to the Windows Firewall. Use this approach if you have an alternate
firewall solution.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPDistributedCacheService EnableDistributedCache
{
Name = "AppFabricCachingService"
CacheSizeInMB = 8192
ServiceAccount = "DEMO\ServiceAccount"
InstallAccount = $SetupAccount
CreateFirewallRules = $false
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPUserProfileProperty/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example deploys/updates the WorkEmail2 property in the user profile service
app
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPUserProfileProperty WorkEmailProperty
{
Name = "WorkEmail2"
Ensure = "Present"
UserProfileService = "User Profile Service Application"
DisplayName = "Work Email"
Type = "Email"
Description = "" #implementation isn't using it yet
PolicySetting = "Mandatory"
PrivacySetting = "Public"
MappingConnectionName = "contoso.com"
MappingPropertyName = "mail"
MappingDirection = "Import"
Length = 10
DisplayOrder =25
IsEventLog =$false
IsVisibleOnEditor=$true
IsVisibleOnViewer = $true
IsUserEditable = $true
IsAlias = $false
IsSearchable = $false
TermStore = ""
TermGroup = ""
TermSet = ""
UserOverridePrivacy = $false
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPFarm/2-CreateCustomCentralAdmin.ps1
|
2-CreateCustomCentralAdmin.ps1
|
<#
.EXAMPLE
This example shows how a basic SharePoint farm can be created. The database server and names
are specified, and the accounts to run the setup as, the farm account and the passphrase are
all passed in to the configuration to be applied. Here the port for the central admin site to
run on, as well as the authentication mode for the site are also specified.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$FarmAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$Passphrase
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPFarm SharePointFarm
{
Ensure = "Present"
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
FarmConfigDatabaseName = "SP_Config"
AdminContentDatabaseName = "SP_AdminContent"
CentralAdministrationPort = 5000
CentralAdministrationAuth = "Kerberos"
Passphrase = $Passphrase
FarmAccount = $FarmAccount
RunCentralAdmin = $true
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPFarm/1-CreateBasicFarm.ps1
|
1-CreateBasicFarm.ps1
|
<#
.EXAMPLE
This example shows how a basic SharePoint farm can be created. The database server and names
are specified, and the accounts to run the setup as, the farm account and the passphrase are
all passed in to the configuration to be applied. By default the central admin site in this
example is provisioned to port 9999 using NTLM authentication.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$FarmAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$Passphrase
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPFarm SharePointFarm
{
Ensure = "Present"
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
FarmConfigDatabaseName = "SP_Config"
AdminContentDatabaseName = "SP_AdminContent"
Passphrase = $Passphrase
FarmAccount = $FarmAccount
RunCentralAdmin = $true
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPFarm/3-CreateFarmWithServerRole.ps1
|
3-CreateFarmWithServerRole.ps1
|
<#
.EXAMPLE
This example shows how a basic SharePoint farm can be created. The database server and names
are specified, and the accounts to run the setup as, the farm account and the passphrase are
all passed in to the configuration to be applied. By default the central admin site in this
example is provisioned to port 9999 using NTLM authentication. In this example we also see
the server role defined as "Application" which tells SharePoint 2016 the role to apply to
this server as soon as the farm is created. This property is not supported for SharePoint 2013
and so this specific example would fail if used against that verison.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$FarmAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$Passphrase
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPFarm SharePointFarm
{
Ensure = "Present"
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
FarmConfigDatabaseName = "SP_Config"
AdminContentDatabaseName = "SP_AdminContent"
ServerRole = "Application"
Passphrase = $Passphrase
FarmAccount = $FarmAccount
RunCentralAdmin = $true
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPTrustedRootAuthority/2-RemoveExample.ps1
|
2-RemoveExample.ps1
|
<#
.EXAMPLE
This example removes a SP Trusted Root Authority from the local farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPTrustedRootAuthority SampleRootAuthority
{
Name = "Contoso"
CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB"
Ensure = "Absent"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPTrustedRootAuthority/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example deploys a SP Trusted Root Authority to the local farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPTrustedRootAuthority SampleRootAuthority
{
Name = "Contoso"
CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB"
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPManagedPath/3-RemovePath.ps1
|
3-RemovePath.ps1
|
<#
.EXAMPLE
This example shows how to remove a wildcard managed path from a specific web application
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPManagedPath TestManagedPath
{
WebAppUrl = "http://sharepoint.contoso.com"
InstallAccount = $SetupAccount
RelativeUrl = "teams"
Explicit = $false
HostHeader = $true
Ensure = "Absent"
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPManagedPath/1-ExplicitPath.ps1
|
1-ExplicitPath.ps1
|
<#
.EXAMPLE
This example shows how to deploy an explicit managed path to a specifici web application
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPManagedPath TestManagedPath
{
WebAppUrl = "http://sharepoint.contoso.com"
InstallAccount = $SetupAccount
RelativeUrl = "example"
Explicit = $true
HostHeader = $false
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPManagedPath/2-WildcardPath.ps1
|
2-WildcardPath.ps1
|
<#
.EXAMPLE
This example shows how to add a wildcard managed path to a specific web application
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPManagedPath TestManagedPath
{
WebAppUrl = "http://sharepoint.contoso.com"
InstallAccount = $SetupAccount
RelativeUrl = "teams"
Explicit = $false
HostHeader = $true
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPServiceAppPool/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example creates a service application pool for service apps to run in.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPServiceAppPool MainServiceAppPool
{
Name = "SharePoint Service Applications"
ServiceAccount = "Demo\ServiceAccount"
PsDscRunAsCredential = $SetupAccount
Ensure = "Present"
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPSearchResultSource/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example shows how to create a remote sharepoint search result source
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPSearchResultSource RemoteSharePointFarm
{
Name = "External SharePoint results"
SearchServiceAppName = "Search Service Application"
Query = "{searchTerms}"
ProviderType = "Remote SharePoint Provider"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPFarmSolution/1-DeploySolution.ps1
|
1-DeploySolution.ps1
|
<#
.EXAMPLE
This example shows how to deploy a WSP to specific web applications.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPFarmSolution SampleWsp
{
Name = "MySolution.wsp"
LiteralPath = "C:\src\MySolution.wsp"
Ensure = "Present"
Version = "1.0.0"
WebApplications = @("http://collaboration", "http://mysites")
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPUserProfileSection/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example adds a new section for profile properties to the specified
user profile service app
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPUserProfileSection PersonalInformationSection
{
Name = "PersonalInformationSection"
UserProfileService = "User Profile Service Application"
DisplayName = "Personal Information"
DisplayOrder = 5000
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPConfigWizard/1-RunConfigWizard.ps1
|
1-RunConfigWizard.ps1
|
<#
.EXAMPLE
This example runs the Configuration Wizard as soon as it is applied.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPConfigWizard RunConfigWizard
{
Ensure = "Present"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPConfigWizard/2-RunConfigWizardInWindow.ps1
|
2-RunConfigWizardInWindow.ps1
|
<#
.EXAMPLE
This example only runs the Configuration Wizard in the specified window:
- Saturday and Sunday night between 3am and 5am.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPConfigWizard RunConfigWizard
{
Ensure = "Present"
DatabaseUpgradeDays = "sat", "sun"
DatabaseUpgradeTime = "3:00am to 5:00am"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPServiceAppSecurity/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example shows how full control permission can be given to the farm
account and service app pool account to the user profile service app's
sharing permission.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
$membersToInclude = @()
$membersToInclude += MSFT_SPServiceAppSecurityEntry {
Username = "CONTOSO\SharePointFarmAccount"
AccessLevel = "Full Control"
}
$membersToInclude += MSFT_SPServiceAppSecurityEntry {
Username = "CONTOSO\SharePointServiceApps"
AccessLevel = "Full Control"
}
SPServiceAppSecurity UserProfileServiceSecurity
{
ServiceAppName = "User Profile Service Application"
SecurityType = "SharingPermissions"
MembersToInclude = $membersToInclude
MembersToExclude = @("CONTOSO\BadAccount1", "CONTOSO\BadAccount2")
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPUserProfileSyncService/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example provisions the user profile sync service to the local server
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount,
[Parameter(Mandatory = $true)]
[PSCredential]
$FarmAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPUserProfileSyncService UserProfileSyncService
{
UserProfileServiceAppName = "User Profile Service Application"
Ensure = "Present"
FarmAccount = $FarmAccount
RunOnlyWhenWriteable = $true
InstallAccount = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPAccess2010ServiceApp/1-CreateServiceApp.ps1
|
1-CreateServiceApp.ps1
|
<#
.EXAMPLE
This example shows how to deploy Access Services 2010 to the local SharePoint farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPAccessServices2010 Access2010Services
{
Name = "Access 2010 Services Service Application"
ApplicationPool = "SharePoint Service Applications"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPAccess2010ServiceApp/2-RemoveServiceApp.ps1
|
2-RemoveServiceApp.ps1
|
<#
.EXAMPLE
This example shows how to remove a specific Access Services 2010 from the local
SharePoint farm. Because Application pool is a required parameters, but is not
acutally needed to remove the app, any text value can be supplied for these as
they will be ignored.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPAccessServices2010 Access2010Services
{
Name = "Access 2010 Services Service Application"
ApplicationPool = "n/a"
Ensure = "Absent"
PsDscRunAsCredential = $SetupAccount
}
}
}
|
PowerShellCorpus/PowerShellGallery/SharePointDSC/1.7.0.0/Examples/Resources/SPQuotaTemplate/1-Example.ps1
|
1-Example.ps1
|
<#
.EXAMPLE
This example creates a specific quota template in the local farm.
#>
Configuration Example
{
param(
[Parameter(Mandatory = $true)]
[PSCredential]
$SetupAccount
)
Import-DscResource -ModuleName SharePointDsc
node localhost {
SPQuotaTemplate TeamsiteTemplate
{
Name = "Teamsite"
StorageMaxInMB = 1024
StorageWarningInMB = 512
MaximumUsagePointsSolutions = 1000
WarningUsagePointsSolutions = 800
Ensure = "Present"
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.