Skip to content

Commit

Permalink
Merge pull request #300 from PowerShell/dev
Browse files Browse the repository at this point in the history
Merging release pull request
  • Loading branch information
kwirkykat authored Dec 17, 2016
2 parents 44194e0 + 00bef17 commit d15b52f
Show file tree
Hide file tree
Showing 136 changed files with 17,981 additions and 9,451 deletions.
38 changes: 19 additions & 19 deletions DSCResources/MSFT_xArchive/MSFT_xArchive.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function Get-TargetResource

if ($null -eq $Credential)
{
$PSBoundParameters.Remove('Credential')
$PSBoundParameters.Remove('Credential') > $null
}

$ensureValue = 'Absent'
Expand Down Expand Up @@ -173,7 +173,7 @@ function Set-TargetResource

Write-Verbose -Message $LocalizedData.ConfigurationStarted

if (-not (Test-Path -Path $Destination))
if (-not (Test-Path -LiteralPath $Destination))
{
New-Item -Path $Destination -ItemType Directory | Out-Null
}
Expand Down Expand Up @@ -245,7 +245,7 @@ function Set-TargetResource
if (-not $Checksum -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFile -f $archiveEntryDestinationPath), $null, $null))
{
Write-Verbose -Message ($LocalizedData.RemovingDir -f $archiveEntryDestinationPath)
Remove-Item -Path $archiveEntryDestinationPath
Remove-Item -LiteralPath $archiveEntryDestinationPath
continue
}

Expand All @@ -254,7 +254,7 @@ function Set-TargetResource
if ((Test-FileHashMatchesArchiveEntryHash -FilePath $archiveEntryDestinationPath -ArchiveEntry $archiveEntry -HashAlgorithmName $Checksum) -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFile -f $archiveEntryDestinationPath), $null, $null))
{
Write-Verbose -Message ($LocalizedData.HashesOfExistingAndZipFilesMatchRemoving)
Remove-Item -Path $archiveEntryDestinationPath
Remove-Item -LiteralPath $archiveEntryDestinationPath
}
else
{
Expand All @@ -267,7 +267,7 @@ function Set-TargetResource
if ($relevantTimestamp.Equals($archiveEntry.LastWriteTime.DateTime) -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFile -f $archiveEntryDestinationPath), $null, $null))
{
Write-Verbose -Message ($LocalizedData.InSetTargetResourceexistsselectedtimestampmatched -f $archiveEntryDestinationPath, $Checksum)
Remove-Item -Path $archiveEntryDestinationPath
Remove-Item -LiteralPath $archiveEntryDestinationPath
}
else
{
Expand Down Expand Up @@ -296,7 +296,7 @@ function Set-TargetResource
-and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveDirectory -f $fileInfoAtDestinationPath), $null, $null))
{
Write-Verbose -Message ($LocalizedData.ExistingaAppearsToBeAneEmptyDirectoryRemovingit -f $fileInfoAtDestinationPath)
Remove-Item -Path $fileInfoAtDestinationPath
Remove-Item -LiteralPath $fileInfoAtDestinationPath
}
}

Expand Down Expand Up @@ -388,7 +388,7 @@ function Set-TargetResource

if ($PSCmdlet.ShouldProcess(($LocalizedData.RemoveDirectory -f $archiveEntryDestinationPath), $null, $null))
{
Remove-Item -Path $archiveEntryDestinationPath -Recurse -Force | Out-Null
Remove-Item -LiteralPath $archiveEntryDestinationPath -Recurse -Force | Out-Null
}
}
else
Expand All @@ -400,7 +400,7 @@ function Set-TargetResource
}

$archiveEntryDestinationParentPath = Split-Path -Path $archiveEntryDestinationPath
if (-not (Test-Path $archiveEntryDestinationParentPath) -and $PSCmdlet.ShouldProcess(($LocalizedData.MakeDirectory -f $archiveEntryDestinationParentPath), $null, $null))
if (-not (Test-Path -LiteralPath $archiveEntryDestinationParentPath) -and $PSCmdlet.ShouldProcess(($LocalizedData.MakeDirectory -f $archiveEntryDestinationParentPath), $null, $null))
{
<#
TODO: This is an edge case we need to revisit. We should be correctly handling wrong file types along
Expand Down Expand Up @@ -451,9 +451,9 @@ function Set-TargetResource
$updatedTimestamp = $archiveEntry.LastWriteTime.DateTime
$archiveEntry.ExistingItemTimestamp = $updatedTimestamp

Set-ItemProperty -Path $archiveEntryDestinationPath -Name 'LastWriteTime' -Value $updatedTimestamp
Set-ItemProperty -Path $archiveEntryDestinationPath -Name 'LastAccessTime' -Value $updatedTimestamp
Set-ItemProperty -Path $archiveEntryDestinationPath -Name 'CreationTime' -Value $updatedTimestamp
Set-ItemProperty -LiteralPath $archiveEntryDestinationPath -Name 'LastWriteTime' -Value $updatedTimestamp
Set-ItemProperty -LiteralPath $archiveEntryDestinationPath -Name 'LastAccessTime' -Value $updatedTimestamp
Set-ItemProperty -LiteralPath $archiveEntryDestinationPath -Name 'CreationTime' -Value $updatedTimestamp
}
}
finally
Expand Down Expand Up @@ -571,7 +571,7 @@ function Test-TargetResource
if ($archiveEntryDestinationPath.EndsWith('\'))
{
$archiveEntryDestinationPath = $archiveEntryDestinationPath.TrimEnd('\')
if (-not (Test-Path -Path $archiveEntryDestinationPath -PathType Container))
if (-not (Test-Path -LiteralPath $archiveEntryDestinationPath -PathType Container))
{
Write-Verbose ($LocalizedData.DestMissingOrIncorrectTypeReason -f $archiveEntryDestinationPath)
$individualResult = $result = $false
Expand Down Expand Up @@ -749,7 +749,7 @@ function Get-CacheEntry
Write-Verbose -Message ($LocalizedData.UsingKeyToRetrieveHashValue -f $cacheEntryKey)

$cacheEntryPath = Join-Path -Path $script:cacheLocation -ChildPath $cacheEntryKey
if (-not (Test-Path -Path $cacheEntryPath))
if (-not (Test-Path -LiteralPath $cacheEntryPath))
{
Write-Verbose -Message ($LocalizedData.NoCacheValueFound)
}
Expand All @@ -758,7 +758,7 @@ function Get-CacheEntry
# ErrorAction seems to have no affect on this exception, (see: https://microsoft.visualstudio.com/web/wi.aspx?pcguid=cb55739e-4afe-46a3-970f-1b49d8ee7564&id=1185735)
try
{
$cacheEntry = Import-CliXml -Path $cacheEntryPath
$cacheEntry = Import-CliXml -LiteralPath $cacheEntryPath
Write-Verbose -Message ($LocalizedData.CacheValueFoundReturning -f $cacheEntry)
}
catch [System.Xml.XmlException]
Expand Down Expand Up @@ -805,12 +805,12 @@ function Set-CacheEntry
$cacheEntryPath = Join-Path -Path $script:cacheLocation -ChildPath $cacheEntryKey

Write-Verbose -Message ($LocalizedData.AboutToCacheValueInputObject -f $InputObject)
if (-not (Test-Path -Path $script:cacheLocation))
if (-not (Test-Path -LiteralPath $script:cacheLocation))
{
New-Item -Path $script:cacheLocation -ItemType Directory | Out-Null
}

Export-CliXml -Path $cacheEntryPath -InputObject $InputObject
Export-CliXml -LiteralPath $cacheEntryPath -InputObject $InputObject
}

<#
Expand All @@ -833,7 +833,7 @@ function Assert-PathArgumentValid

$ErrorActionPreference = 'Stop'

if (-not (Test-Path -Path $Path -PathType Leaf))
if (-not (Test-Path -LiteralPath $Path -PathType Leaf))
{
New-InvalidArgumentException -Message ($LocalizedData.InvalidSourcePath -f $Path) -ArgumentName 'Path'
}
Expand Down Expand Up @@ -1090,7 +1090,7 @@ function Mount-NetworkPath
$psDrive = $null

# Mount the drive only if not accessible
if (Test-Path -Path $Path -ErrorAction Ignore)
if (Test-Path -LiteralPath $Path -ErrorAction Ignore)
{
Write-Verbose -Message ($LocalizedData.PathPathIsAlreadyAccessiableNoMountNeeded -f $Path)
}
Expand Down Expand Up @@ -1169,7 +1169,7 @@ function New-Directory
if ($Force -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFileAndRecreateAsDirectory -f $Path), $null, $null))
{
Write-Verbose -Message ($LocalizedData.RemovingDir -f $Path)
Remove-Item -Path $Path | Out-Null
Remove-Item -LiteralPath $Path | Out-Null
New-Item -Path $Path -ItemType Directory | Out-Null
}
else
Expand Down
2 changes: 1 addition & 1 deletion DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ function Update-LocationTagInApplicationHostConfigForAuthentication

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration") | Out-Null

$webAdminSrvMgr = new-object Microsoft.Web.Administration.ServerManager
$webAdminSrvMgr = [Microsoft.Web.Administration.ServerManager]::OpenRemote("127.0.0.1")

$appHostConfig = $webAdminSrvMgr.GetApplicationHostConfiguration()

Expand Down
50 changes: 43 additions & 7 deletions DSCResources/MSFT_xGroupResource/MSFT_xGroupResource.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@
with the associated SID of the member that cannot be resolved then continues the operation.
#>

$errorActionPreference = 'Stop'
Set-StrictMode -Version 'Latest'

Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath 'CommonResourceHelper.psm1')
# Import CommonResourceHelper for Test-IsNanoServer
$script:dscResourcesFolderFilePath = Split-Path $PSScriptRoot -Parent
$script:commonResourceHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'CommonResourceHelper.psm1'
Import-Module -Name $script:commonResourceHelperFilePath

$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xGroupResource'

if (-not (Test-IsNanoServer))
Expand Down Expand Up @@ -134,17 +139,20 @@ function Get-TargetResource
This property will replace all the current group members with the specified members.
Members should be specified as strings in the format of their domain qualified name
(domain\username), their UPN (username@domainname), their distinguished name (CN=username,DC=...), or their username (for local machine accounts).
(domain\username), their UPN (username@domainname), their distinguished name (CN=username,DC=...),
or their username (for local machine accounts).
Using either the MembersToExclude or MembersToInclude properties in the same configuration as this property will generate an error.
Using either the MembersToExclude or MembersToInclude properties in the same configuration
as this property will generate an error.
.PARAMETER MembersToInclude
The members the group should include.
This property will only add members to a group.
Members should be specified as strings in the format of their domain qualified name
(domain\username), their UPN (username@domainname), their distinguished name (CN=username,DC=...), or their username (for local machine accounts).
(domain\username), their UPN (username@domainname), their distinguished name (CN=username,DC=...),
or their username (for local machine accounts).
Using the Members property in the same configuration as this property will generate an error.
Expand All @@ -154,7 +162,8 @@ function Get-TargetResource
This property will only remove members from a group.
Members should be specified as strings in the format of their domain qualified name
(domain\username), their UPN (username@domainname), their distinguished name (CN=username,DC=...), or their username (for local machine accounts).
(domain\username), their UPN (username@domainname), their distinguished name (CN=username,DC=...),
or their username (for local machine accounts).
Using the Members property in the same configuration as this property will generate an error.
Expand All @@ -163,10 +172,15 @@ function Get-TargetResource
An error will occur if this account does not have the appropriate Active Directory permissions to add all
non-local accounts to the group.
.NOTES
ShouldProcess PSSA rule is suppressed because Set-TargetResourceOnFullSKU and
Set-TargetResourceOnNanoServer call ShouldProcess.
#>
function Set-TargetResource
{
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')]
[CmdletBinding(SupportsShouldProcess = $true)]
param
(
[Parameter(Mandatory = $true)]
Expand Down Expand Up @@ -2264,8 +2278,23 @@ function Split-MemberName
return [System.String[]] @( $scope, $accountName )
}

<#
.SYNOPSIS
Finds a principal by identity.
Wrapper function for testing.
.PARAMETER PrincipalContext
The principal context to find the principal in.
.PARAMETER IdentityValue
The identity value to find the principal by (e.g. username).
.PARAMETER IdentityType
The identity type of the principal to find.
#>
function Find-Principal
{
[OutputType([System.DirectoryServices.AccountManagement.Principal])]
[CmdletBinding()]
param
(
Expand Down Expand Up @@ -2343,6 +2372,13 @@ function Get-Group
return $group
}

<#
.SYNOPSIS
Retrieves the members of a group from the underlying directory entry.
.PARAMETER Group
The group to retrieve the members of.
#>
function Get-GroupMembersFromDirectoryEntry
{
[CmdletBinding()]
Expand Down Expand Up @@ -2423,7 +2459,7 @@ function Add-GroupMember
#>
function Remove-GroupMember
{
[CmdletBinding(SupportsShouldProcess = $true)]
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
Expand Down
Loading

0 comments on commit d15b52f

Please sign in to comment.