Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
- Added PowerShell Dsc Resource Help Files.
- AccountPolicy:
- Improved and updated unit tests to Pester v4 format.
- Updated SecurityPolicyResourceHelper functions to use the full path to the secedit program when invoked.
[Issue #116](https://github.com/dsccommunity/SecurityPolicyDsc/issues/116).

### Fixed

Expand Down
5 changes: 5 additions & 0 deletions Tests/Unit/SecurityPolicyResourceHelper.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ InModuleScope $script:subModuleName {
{ ConvertTo-LocalFriendlyName -Identity 'S-1-5-32-600' -Scope 'Set' } | Should throw
}
}

Describe 'SecurityPolicyResourceHelper\Invoke-Secedit' {
Mock Start-Process

Expand All @@ -60,6 +61,7 @@ InModuleScope $script:subModuleName {
Assert-MockCalled -CommandName Start-Process -Exactly 1
}
}

Describe 'SecurityPolicyResourceHelper\Get-UserRightsAssignment' {
BeforeAll {
$ini = "$PSScriptRoot\..\TestHelpers\TestIni.txt"
Expand All @@ -80,6 +82,7 @@ InModuleScope $script:subModuleName {
$result.section.Key1 | Should be 'Value1'
}
}

Describe 'SecurityPolicyResourceHelper\Test-IdentityIsNull' {
It 'Should return true when Identity is null' {
$IdentityIsNull = Test-IdentityIsNull -Identity $null
Expand All @@ -95,6 +98,7 @@ InModuleScope $script:subModuleName {
$IdentityIsNull | Should Be $false
}
}

Describe 'SecurityPolicyResourceHelper\Get-SecurityPolicy' {
BeforeAll {
$ini = "$PSScriptRoot\..\TestHelpers\sample.inf"
Expand Down Expand Up @@ -146,6 +150,7 @@ InModuleScope $script:subModuleName {
}

}

Describe 'SecurityPolicyResourceHelper\Test ConvertTo-SDDLDescriptor' {
It 'Should be BA' {
$identity = "BUILTIN\Administrators"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ function Invoke-Secedit
$arguments = $arguments + " /overwrite /quiet"
}

$secEditCmd = Get-Command -Name 'secedit.exe'

Write-Verbose "secedit arguments: $arguments"
Start-Process -FilePath secedit.exe -ArgumentList $arguments -RedirectStandardOutput $seceditOutput `
Start-Process -FilePath $secEditCmd.Path -ArgumentList $arguments -RedirectStandardOutput $seceditOutput `
-NoNewWindow -Wait
}

Expand Down Expand Up @@ -138,7 +140,8 @@ function Get-SecurityPolicy

Write-Debug -Message ($localizedData.EchoDebugInf -f $currentSecurityPolicyFilePath)

secedit.exe /export /cfg $currentSecurityPolicyFilePath /areas $Area | Out-Null
$secEditCmd = Get-Command -Name 'secedit.exe'
& $secEditCmd.Path /export /cfg $currentSecurityPolicyFilePath /areas $Area | Out-Null
}

$policyConfiguration = @{}
Expand Down