Overview of wmi_user.inc

Public Function Summary

Public functions are intended to be called by the code that imports this library.

Name Summary
wmi_user_group
wmi_user_groupuser
wmi_user_is_uesraccount_disabled
wmi_user_is_user_locked
wmi_user_is_userpass_changeable
wmi_user_is_userpass_expires
wmi_user_is_userpass_required
wmi_user_sysaccount
wmi_user_useraccount

Public Function Details

wmi_user_group

Named Parameters

grpName
handle

Code

function wmi_user_group(handle, grpName)
{
  if(!usrName){
    query = "Select SID from Win32_Group";
  }
  else {
    query = 'Select * from Win32_Group Where Name = ' +
             raw_string(0x22) + grpName + raw_string(0x22);
  }

  grpList = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< grpList) || !grpList){
    return(0);
  }

  return grpList;
}

function wmi_user_groupuser(handle)

		
top

wmi_user_groupuser

Named Parameters

handle

Code

function wmi_user_groupuser(handle)
{
  query = 'Select * from Win32_GroupUser';

  grpList = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< grpList) || !grpList){
    return(0);
  }

  return grpList;
}

# Ex: usrName = "Administrator"

		
top

wmi_user_is_uesraccount_disabled

Named Parameters

handle
usrName

Code

function wmi_user_is_uesraccount_disabled(handle, usrName)
{
  if(!usrName){
    return(0);
  }
  else {
    query = 'Select Disabled from Win32_UserAccount Where Name = ' +
             raw_string(0x22) + usrName + raw_string(0x22);
  }

  usrName = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< usrName) || !usrName){
    return(0);
  }

  return usrName;
}

function wmi_user_is_userpass_changeable(handle, usrName)

		
top

wmi_user_is_user_locked

Named Parameters

handle
usrName

Code

function wmi_user_is_user_locked(handle, usrName)
{
  if(!usrName){
    query = 'Select Lockout from Win32_UserAccount';
  }
  else {
    query = 'Select Lockout from Win32_UserAccount Where Name =' +
             raw_string(0x22) + usrName + raw_string(0x22);
  }

  usrName = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< usrName) || !usrName){
    return(0);
  }

  return usrName;
}


		
top

wmi_user_is_userpass_changeable

Named Parameters

handle
usrName

Code

function wmi_user_is_userpass_changeable(handle, usrName)
{
  if(!usrName){
    query = 'Select PasswordChangeable from Win32_UserAccount';
  }
  else {
    query = 'Select PasswordChangeable from Win32_UserAccount Where Name =' +
             raw_string(0x22) + usrName + raw_string(0x22);
  }

  usrName = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< usrName) || !usrName){
    return(0);
  }

  return usrName;
}

function wmi_user_is_userpass_expires(handle, usrName)

		
top

wmi_user_is_userpass_expires

Named Parameters

handle
usrName

Code

function wmi_user_is_userpass_expires(handle, usrName)
{
  if(!usrName){
    query = 'Select PasswordExpires from Win32_UserAccount';
  }
  else {
    query = 'Select PasswordExpires from Win32_UserAccount Where Name =' +
             raw_string(0x22) + usrName + raw_string(0x22);
  }

  usrName = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< usrName) || !usrName){
    return(0);
  }

  return usrName;
}

function wmi_user_is_userpass_required(handle, usrName)

		
top

wmi_user_is_userpass_required

Named Parameters

handle
usrName

Code

function wmi_user_is_userpass_required(handle, usrName)
{
  if(!usrName){
    query = 'Select PasswordRequired from Win32_UserAccount';
  }
  else {
    query = 'Select PasswordRequired from Win32_UserAccount Where Name =' +
             raw_string(0x22) + usrName + raw_string(0x22);
  }

  usrName = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< usrName) || !usrName){
    return(0);
  }

  return usrName;
}

function wmi_user_is_user_locked(handle, usrName)

		
top

wmi_user_sysaccount

Named Parameters

handle
usrName

Code

function wmi_user_sysaccount(handle, usrName)
{
  if(!usrName){
    query = "Select SID from Win32_SystemAccount";
  }
  else {
    query = 'Select * from Win32_SystemAccount Where Name = ' +
             raw_string(0x22) + usrName + raw_string(0x22);
  }

  usrList = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< usrList) || !usrList){
    return(0);
  }

  return usrList;
}

# Ex: usrName = "Administrator"

		
top

wmi_user_useraccount

Named Parameters

handle
usrName

Code

function wmi_user_useraccount(handle, usrName)
{
  if(!usrName){
    query = "Select SID from Win32_UserAccount";
  }
  else {
    query = 'Select * from Win32_UserAccount Where Name = ' +
             raw_string(0x22) + usrName + raw_string(0x22);
  }

  usrList = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< usrList) || !usrList){
    return(0);
  }

  return usrList;
}

# Ex:  grpName = "Administrators"

		
top