PowerShell folder permission error - Some or all identity references could not be translated.

后端 未结 4 1805
长发绾君心
长发绾君心 2020-12-18 22:03

I have read many posts about this, but I still can\'t get it. I am running this script as Admin and It does create the folders requred, just does not set the appropriate per

4条回答
  •  星月不相逢
    2020-12-18 22:23

    Adding this in case any C#/ASP.NET developers get this (which is my scenario, and I found this post).

    I am using .NET Core in a corporate environment, and I need to check UserGroups as part of security. The code is like (where "user" is a ClaimsPrincipal):

    var windowsIdentity = user.Identity as WindowsIdentity;
    if( windowsIdentity is null )
        throw new Exception( $"Invalid Windows Identity {user.Identity.Name}" );
    return windowsIdentity.Groups
        .Select( g => g.Translate( typeof( NTAccount ) ).Value );
    

    Anyway, someone in charge of groups deleted a group I was part of, and the AD replication lag caused me to get the error in the title. A logoff and/or reboot worked just fine.

提交回复
热议问题