Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when calling "SetAccessRule" with 1 argument (s): "Some or all identity references could not be translated #172

Closed
matthias-schlimm opened this issue Jan 4, 2020 · 8 comments · Fixed by #189

Comments

@matthias-schlimm
Copy link
Collaborator

@matthias-schlimm matthias-schlimm commented Jan 4, 2020

BISF,psm1 -> Set-BISFACLrights

Exception when calling "SetAccessRule" with 1 argument (s): "Some or all identity references could not be translated."
In C:\Program Files (x86)\Base Image Script Framework (BIS-F)\framework\SubCall\Global\BISF.psm1:3714 Zeichen:2
+     $acl.SetAccessRule($rule)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IdentityNotMappedException
Exception when calling "SetAccessRule" with 1 argument (s): "Some or all identity references could not be translated."
In C:\Program Files (x86)\Base Image Script Framework (BIS-F)\framework\SubCall\Global\BISF.psm1:3714 Zeichen:2
+     $acl.SetAccessRule($rule)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IdentityNotMappedException
@matthias-schlimm

This comment has been minimized.

Copy link
Collaborator Author

@matthias-schlimm matthias-schlimm commented Jan 4, 2020

using SID instead of the name ?

@matthias-schlimm

This comment has been minimized.

Copy link
Collaborator Author

@matthias-schlimm matthias-schlimm commented Jan 4, 2020

better errorhandling

try {
		$acl.SetAccessRule($rule)
	}
	catch {
		Write-BISFlog -Msg "Error during set NTFS rights. The error is: $_" -Type W -SubMsg
	}
@matthias-schlimm matthias-schlimm added Type: Bug and removed Type: Bug labels Jan 5, 2020
@matthias-schlimm

This comment has been minimized.

Copy link
Collaborator Author

@matthias-schlimm matthias-schlimm commented Jan 5, 2020

On a system the NTFS right are set correctly
image

@matthias-schlimm

This comment has been minimized.

Copy link
Collaborator Author

@matthias-schlimm matthias-schlimm commented Jan 5, 2020

the Local Service is the issue, using SID now

old:
$perm = "local service", "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow"

new:
$perm = "S-1-5-19", "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow"

@andre-sicking

This comment has been minimized.

Copy link

@andre-sicking andre-sicking commented Jan 15, 2020

Just replacing the SID does not work in my tests. But you could resolve the SID to the localized name on the running system.

$localServiceSID = New-Object System.Security.Principal.SecurityIdentifier("S-1-5-19") $localServiceName = ($localServiceSID.Translate( [System.Security.Principal.NTAccount])).Value

This resolves to "NT-AUTORITÄT\Lokaler Dienst" on a german system and works when used with the rest of the code.

@EUCweb

This comment has been minimized.

Copy link
Owner

@EUCweb EUCweb commented Jan 15, 2020

@EUCweb

This comment has been minimized.

Copy link
Owner

@EUCweb EUCweb commented Jan 15, 2020

@andre-sicking

This comment has been minimized.

Copy link

@andre-sicking andre-sicking commented Jan 15, 2020

done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
7.1912.1
  
Awaiting triage
3 participants
You can’t perform that action at this time.