Skip to content

Can't set perms for APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES #9

@tehsuk

Description

@tehsuk

Sample config:

Configuration TestAppPackagePerms
{
    Import-DscResource -ModuleName "cNtfsAccessControl"
    Import-DscResource -ModuleName "PSDesiredStateConfiguration"
	File CreateTestFolder
	{
		Type = "Directory"
		DestinationPath = "C:\Program Files\Test"
		Ensure = "Present"
	}

	cNtfsPermissionsInheritance DisableInheritOnProgramFilesTest
	{
		Path = "C:\Program Files\Test"
		Enabled = $false
		PreserveInherited = $false
		DependsOn = "[File]CreateTestFolder"
	}

	cNtfsPermissionEntry SetPermsOnCTestForApplicationPackageAuthority
	{
		Ensure = "Present"
		Path = "C:\Program Files\Test"
		# For Principal, same results using the following:
		# "ALL APPLICATION PACKAGES"
		# "S-1-15-2-1"
		Principal = "APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES" 
		AccessControlInformation = @(
			cNtfsAccessControlInformation
			{
				AccessControlType = "Allow"
				FileSystemRights = "ReadAndExecute"
				Inheritance = "ThisFolderSubfoldersAndFiles"
			}
        )
        DependsOn = "[cNtfsPermissionsInheritance]DisableInheritOnProgramFilesTest"
	}
}

TestAppPackagePerms -Verbose
Start-DscConfiguration -Path .\TestAppPackagePerms -Wait -Verbose -Force

Result:

VERBOSE: [SERVER]: LCM:  [ Start  Resource ]  [[cNtfsPermissionEntry]SetPermsOnCTestForApplicationPackageAuthority]
VERBOSE: [SERVER]: LCM:  [ Start  Test     ]  [[cNtfsPermissionEntry]SetPermsOnCTestForApplicationPackageAuthority]
VERBOSE: [SERVER]:                            [[cNtfsPermissionEntry]SetPermsOnCTestForApplicationPackageAuthority] Ensure                   : 'Present'
VERBOSE: [SERVER]:                            [[cNtfsPermissionEntry]SetPermsOnCTestForApplicationPackageAuthority] Path                     : 'C:\Program Files\Test'
VERBOSE: [SERVER]:                            [[cNtfsPermissionEntry]SetPermsOnCTestForApplicationPackageAuthority] Principal                : 'APPLICATION PACKAGE AU
THORITY\ALL APPLICATION PACKAGES'
VERBOSE: [SERVER]:                            [[cNtfsPermissionEntry]SetPermsOnCTestForApplicationPackageAuthority] AccessControlInformation : 'cNtfsAccessControlInfo
rmation'
VERBOSE: [SERVER]:                            [[cNtfsPermissionEntry]SetPermsOnCTestForApplicationPackageAuthority] Verbose                  : 'True'
VERBOSE: [SERVER]:                            [[cNtfsPermissionEntry]SetPermsOnCTestForApplicationPackageAuthority] Resolving identity reference 'APPLICATION PACKAGE 
AUTHORITY\ALL APPLICATION PACKAGES'.
VERBOSE: [SERVER]: LCM:  [ End    Test     ]  [[cNtfsPermissionEntry]SetPermsOnCTestForApplicationPackageAuthority]  in 0.0780 seconds.
PowerShell DSC resource cNtfsPermissionEntry  failed to execute Test-TargetResource functionality with error message: The running command stopped because the preference 
variable "ErrorActionPreference" or common parameter is set to Stop: Could not resolve identity reference 'APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES': 
'Exception calling "Translate" with "1" argument(s): "Some or all identity references could not be translated."'. 
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost
 
VERBOSE: [SERVER]: LCM:  [ End    Set      ]
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : localhost
 
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 0.8 seconds
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions