try {
  $right = Carbon\Test-Privilege -Identity $($args[0]) -Privilege SeServiceLogonRight
  if (-not $right) {
    Carbon\Grant-Privilege -Identity $($args[0]) -Privilege SeServiceLogonRight
    echo "Changed"
  }
} catch [System.Exception] {
  throw "Carbon\Test-Privilege failed: $url with ${_}"
}

$identity = $($args[0])

try {
  $right = Carbon\Test-Privilege -Identity ${identity} -Privilege SeServiceLogonRight
  if (-not $right) {
    Carbon\Grant-Privilege -Identity ${identity} -Privilege SeServiceLogonRight
    echo "Changed"
  }
} catch [System.Exception] {
  throw "Carbon\Test-Privilege failed: identity=${identity} with ${_}"
}

Handle identity differently in Service User PowerShell script
Handle identity differently in Service User PowerShell script
