-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #591 from PowerShell/release-1.7
Release 1.7
- Loading branch information
Showing
176 changed files
with
8,597 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
185 changes: 185 additions & 0 deletions
185
Modules/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
function Get-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
[OutputType([System.Collections.Hashtable])] | ||
param | ||
( | ||
[parameter(Mandatory = $true)] | ||
[System.String] | ||
$Name, | ||
|
||
[parameter(Mandatory = $true)] | ||
[System.String] | ||
$ApplicationPool, | ||
|
||
[ValidateSet("Present","Absent")] | ||
[System.String] | ||
$Ensure = "Present", | ||
|
||
[System.Management.Automation.PSCredential] | ||
$InstallAccount | ||
) | ||
|
||
Write-Verbose -Message "Getting Access 2010 Service app '$Name'" | ||
|
||
$result = Invoke-SPDSCCommand -Credential $InstallAccount ` | ||
-Arguments $PSBoundParameters ` | ||
-ScriptBlock { | ||
$params = $args[0] | ||
$serviceApps = Get-SPServiceApplication -Name $params.Name ` | ||
-ErrorAction SilentlyContinue | ||
$nullReturn = @{ | ||
Name = $params.Name | ||
ApplicationPool = $params.ApplicationPool | ||
Ensure = "Absent" | ||
} | ||
if($null -eq $serviceApps) | ||
{ | ||
return $nullReturn | ||
} | ||
|
||
$serviceApp = $serviceApps | Where-Object -FilterScript { | ||
$_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" | ||
} | ||
|
||
if($null -eq $serviceApp) | ||
{ | ||
return $nullReturn | ||
} | ||
else | ||
{ | ||
return @{ | ||
Name = $serviceApp.DisplayName | ||
ApplicationPool = $serviceApp.ApplicationPool.Name | ||
Ensure = "Present" | ||
InstallAccount = $params.InstallAccount | ||
} | ||
} | ||
} | ||
return $result | ||
} | ||
|
||
function Set-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
param | ||
( | ||
[parameter(Mandatory = $true)] | ||
[System.String] | ||
$Name, | ||
|
||
[parameter(Mandatory = $true)] | ||
[System.String] | ||
$ApplicationPool, | ||
|
||
[ValidateSet("Present","Absent")] | ||
[System.String] | ||
$Ensure = "Present", | ||
|
||
[System.Management.Automation.PSCredential] | ||
$InstallAccount | ||
) | ||
|
||
Write-Verbose -Message "Setting Access 2010 Services app '$Name'" | ||
$result = Get-TargetResource @PSBoundParameters | ||
|
||
if($result.Ensure -eq "Absent" -and $Ensure -eq "Present") | ||
{ | ||
Write-Verbose "Creating Access 2010 Service Application '$Name'" | ||
Invoke-SPDSCCommand -Credential $InstallAccount ` | ||
-Arguments $PSBoundParameters ` | ||
-ScriptBlock { | ||
$params = $args[0] | ||
$accessApp = New-SPAccessServiceApplication -Name $params.Name ` | ||
-ApplicationPool $params.ApplicationPool | ||
} | ||
} | ||
if($result.Ensure -eq "Present" -and $Ensure -eq "Present") | ||
{ | ||
Write-Verbose "Updating Access 2010 service application '$Name'" | ||
Invoke-SPDSCCommand -Credential $InstallAccount ` | ||
-Arguments $PSBoundParameters ` | ||
-ScriptBlock { | ||
$params = $args[0] | ||
$apps = Get-SPServiceApplication -Name $params.Name ` | ||
-ErrorAction SilentlyContinue | ||
if($null -ne $apps) | ||
{ | ||
$app = $apps | Where-Object -FilterScript { | ||
$_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" | ||
} | ||
if($null -ne $app) | ||
{ | ||
$appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool | ||
if($null -ne $appPool) | ||
{ | ||
$app.ApplicationPool = $appPool | ||
$app.Update() | ||
return; | ||
} | ||
} | ||
} | ||
|
||
$accessApp = New-SPAccessServiceApplication -Name $params.Name ` | ||
-ApplicationPool $params.ApplicationPool | ||
} | ||
} | ||
if($Ensure -eq "Absent") | ||
{ | ||
Write-Verbose "Removing Access 2010 service application '$Name'" | ||
Invoke-SPDSCCommand -Credential $InstallAccount ` | ||
-Arguments $PSBoundParameters ` | ||
-ScriptBlock { | ||
$params = $args[0] | ||
|
||
$apps = Get-SPServiceApplication -Name $params.Name ` | ||
-ErrorAction SilentlyContinue | ||
if($null -eq $apps) | ||
{ | ||
return | ||
} | ||
|
||
$app = $apps | Where-Object -FilterScript { | ||
$_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" | ||
} | ||
|
||
if($null -ne $app) | ||
{ | ||
Remove-SPServiceApplication -Identity $app -Confirm:$false | ||
} | ||
} | ||
} | ||
} | ||
|
||
function Test-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
[OutputType([System.Boolean])] | ||
param | ||
( | ||
[parameter(Mandatory = $true)] | ||
[System.String] | ||
$Name, | ||
|
||
[parameter(Mandatory = $true)] | ||
[System.String] | ||
$ApplicationPool, | ||
|
||
[ValidateSet("Present","Absent")] | ||
[System.String] | ||
$Ensure = "Present", | ||
|
||
[System.Management.Automation.PSCredential] | ||
$InstallAccount | ||
) | ||
Write-Verbose -Message "Testing Access 2010 service app '$Name'" | ||
|
||
$PSBoundParameters.Ensure = $Ensure | ||
$CurrentValues = Get-TargetResource @PSBoundParameters | ||
|
||
return Test-SPDscParameterState -CurrentValues $CurrentValues ` | ||
-DesiredValues $PSBoundParameters ` | ||
-ValuesToCheck @("Name", "ApplicationPool", "Ensure") | ||
} | ||
|
||
Export-ModuleMember -Function *-TargetResource |
9 changes: 9 additions & 0 deletions
9
...SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.schema.mof
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
[ClassVersion("1.0.0.0"), FriendlyName("SPAccessServices2010")] | ||
class MSFT_SPAccessServices2010 : OMI_BaseResource | ||
{ | ||
[Key, Description("The name of the service application")] String Name; | ||
[Required, Description("The name of the application pool to run the service app in")] String ApplicationPool; | ||
[Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; | ||
[Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run thsi resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.