February 12th, 2020

UAC to Plain English in JavaScript

So I wrote this quick javascript code to use in IBM's SDI (TDI/IDI). When querying the microsoft AD for userAccountControl you will get a decimal equivalent of a hex value to tell you what bits in the account is activated (e.g.: 512, 544, etc.) To convert this into plain english the following code does a pretty good job.

function checkUAC(uac) {
  var flags = [
    [0x0001, 'SCRIPT'],
    [0x0002, 'ACCOUNTDISABLE'],
    [0x0008, 'HOMEDIR_REQUIRED'],
    [0x0010, 'LOCKOUT'],
    [0x0020, 'PASSWD_NOTREQD'],
    [0x0040, 'PASSWD_CANT_CHANGE'],
    [0x0200, 'NORMAL_ACCOUNT'],
    [0x2000, 'SERVER_TRUST_ACCOUNT'],
    [0x10000, 'DONT_EXPIRE_PASSWORD'],
    [0x20000, 'MNS_LOGON_ACCOUNT'],
    [0x40000, 'SMARTCARD_REQUIRED'],
    [0x80000, 'TRUSTED_FOR_DELEGATION'],
    [0x100000, 'NOT_DELEGATED'],
    [0x200000, 'USE_DES_KEY_ONLY'],
    [0x400000, 'DONT_REQ_PREAUTH'],
    [0x800000, 'PASSWORD_EXPIRED'],
    [0x04000000, 'PARTIAL_SECRETS_ACCOUNT']

  var response = "";

  for (var i=0; i<flags.length; i++) {
        if ((parseInt(uac) | flags[i][0]) === parseInt(uac)) {
      response = response + (flags[i][1] + " ("+uac+") ");

  return response;

db2 doesn't start due to file permissions

So if you ever have a goofy admin of your db2 instance who decides to do a "chown -R instname:instgrp /home/instname". Then db2 refuses to start or do anything due to bad permissions, you're in a pickle. The best way out of that jar is using db2 instance upgrade command. It resets all the permissions. "db2iupdt instname"