On Tue, Dec 10, 2024 at 6:37 AM Cedric Blancher wrote:

We have a Win10 env with mixed local and domain accounts.
> We cannot lookup up local AND domain users with just the plain
> username from Windows. Instead we have to do lookups twice:
>

I don't know the Cygwin solution, but here's a short PowerShell function
that will do it:

function Resolve-AccountName {
  param(
      [Parameter(Mandatory)]
      [Security.Principal.NTAccount]
      $name
  )
  $sid = $name.Translate([Security.Principal.SecurityIdentifier])
  if ( $null -ne $sid ) {
    $sid.Translate([Security.Principal.NTAccount]).Value
  }
}

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to