Archive

Archive for the ‘Development’ Category

Migrating AD Manager information into Infra

July 27th, 2009 Kurt Wolf No comments

Infra has been a great ITIL toolset for my department.  The only downfall I have run into is some of the simpler integrations or features come at a steep price point.  This integration cannot be that far out of the box for Infra but yet costs thousands of dollars.  Instead I have been spending some time understanding the Infra database and have come up with the following VBS to move the manager information stored in AD into the Infra database.  We have this script to run each night and it keeps everything in order.

   1:  ' Root DN of the Users
   2:  LDAPRootDN = "LDAP://OU=HCL Users,DC=hcl,DC=internal"
   3:   
   4:  ' Infra database DSN
   5:  InfraDSN = "Driver={SQL Server};Server=data01.hcl.internal;Database=infraEnterprise;Trusted_Connection=TRUE"
   6:   
   7:  set objConnection = CreateObject("ADODB.Connection")
   8:  objConnection.ConnectionString = InfraDSN
   9:  objConnection.open
  10:   
  11:  ' Start the process
  12:  ProcessOU(LDAPRootDN)
  13:   
  14:  function ProcessOU ( DN )
  15:      set CNUsers = GetObject(DN)
  16:      for each User in CNUsers
  17:          select case User.class
  18:              case "user"
  19:                  ' Migrate manager information if a manager is defined
  20:                  if ( User.manager <> "" ) then
  21:                      MigrationCount = MigrationCount + 1
  22:                      MigrateManager User.distinguishedName, User.manager
  23:                  else
  24:                      ' No manager information on file
  25:                  end if
  26:              case "organizationalUnit", "container"
  27:                  ' This is an OU, recurse into
  28:                  ProcessOU( User.ADsPath )
  29:          end select
  30:      next
  31:  end function
  32:   
  33:  function MigrateManager ( StaffDN, ManagerDN )
  34:      set Staff = GetObject("LDAP://" + StaffDN)
  35:      set Manager = GetObject("LDAP://" + ManagerDN)
  36:      strQuery = "exec sp_MigrateManager '" + Staff.GUID + "', '" + Manager.GUID + "'"
  37:      set rs = objConnection.execute(strQuery)
  38:  end function

 

The following is the supporting TSQL for the sp_MigrateManager procedure.

   1:  USE infraEnterprise
   2:  GO
   3:   
   4:  IF EXISTS ( (SELECT NAME FROM sysobjects WHERE NAME = 'sp_MigrateManager' AND TYPE = 'P'))
   5:  BEGIN
   6:      DROP PROCEDURE sp_MigrateManager
   7:  END
   8:  GO
   9:   
  10:  CREATE PROCEDURE sp_MigrateManager 
  11:      @StaffGUID NVARCHAR(300),
  12:      @ManagerGUID NVARCHAR(300)
  13:  AS
  14:  BEGIN
  15:   
  16:      DECLARE @ManagerRef INT
  17:      
  18:      SELECT @ManagerRef = COALESCE(REF, 0) FROM AR_USER_ATTRIBUTES WHERE ldap_object_id = @ManagerGUID
  19:      
  20:      UPDATE AR_USER_ATTRIBUTES
  21:      SET
  22:          MANAGER_REF = @ManagerRef
  23:      WHERE
  24:          ldap_object_id = @StaffGUID
  25:      
  26:  END
  27:  GO
Categories: Development, Infra Tags:

PHP version for Mac OS X 10.5

October 29th, 2007 Kurt Wolf No comments

I have been spending the evening looking at my fresh install of Leopard (Mac OS X 10.5). It looks like PHP version 5.2.4 is installed by default. As of today, this is the latest version available. So far, the built in web server is not processing .php pages. I’ll look into that next.

php_version.png

UPDATE: Upgrading to 10.5.1 has resolved the issues displaying PHP pages.

Categories: Development, General, Mac, Systems Tags:

Development Environment

May 25th, 2007 Kurt Wolf No comments

I find myself doing development on Windows, Linux, and Mac. Most of the time this involves working on web applications. As such, I was struggling with finding an editor/IDE that would suite my needs on all of the platforms. I may have found it!

http://www.activestate.com/products/komodo_edit/

Komodo Edit. This is a free package that runs great on all of the platforms. The one big drawback in the lack of an integrated SVN client. I use subversion religiously, even on personal projects. For Windows there is the excellent TortiseSVN client that integrates with Explorer but I am still left with working at the command line for Linux and Mac.

komodo-edit-header-bg.jpg

Categories: Development Tags: