Migrating to win2003 x64 with 32bit COM+ Application..TY Yigeulruseu

Cheese and Rice, I  knew this was out there but didn't think I really had reach out overseas. Spent quite a few hours trying nail down an easy replicatable process to install legacy vb6 COM+ app on to new win2003 x64. First had to battle the 64 vs 32 bit hell. SYTEMWOW64 made me crossed-eyed. Got past that and got hung up trying automate the install of an pre-existing Com+ App, on a win2003x32, in the form of a app.msi + app.msi.cab. Darn thing just didn't want to install. I could re-create manually but the number of steps involved and the icky feeling I was getting forced me to press on looking for a better solution. I found snippets here and there, but nothing quite as complete as what I found here: http://nadobest.egloos.com/9589057, THANK YOU KOREA and GOOGLE TRANSLATE! I would like to give honorable mention to : http://www.carlosag.net/articles/configure-com-plus. This looked solid, but, I'm sure due to the twilight hour, I could not get it to work as I wanted. Anyway, I hack this together and GIVE FULL CREDIT to my new hero overseas, Yigeulruseu.

'--// THANK YOU KOREA: http://nadobest.egloos.com/9589057
'--// Modded to fit my needs

'************************************************* *****************************
'Registers / unregisters a COM / .NET DLL as a COM + app
'************************************************* *****************************
Option Explicit

Dim ApplicationName, ApplicationDescription, Identity, Password

ApplicationName = "MyHappyApp"
ApplicationDescription = "My vb6 dlls"
Identity = InputBox("Enter UserName: ", "[Domain\UserName]")
password = InputBox("Enter Password: ", "Password")

UnInstallApplication ApplicationName

InstallApplication ApplicationName, ApplicationDescription, 2, Identity, password, 3

InstallComponent ApplicationName, "D:\Components\HappyDAL.dll", "Data Acess Layer", 2, 4, -1, 4, 0, 0
InstallComponent ApplicationName, "D:\Components\HappyBUS.dll", "Business Objects/Logic", 2, 4, -1, 4, 0, 0
InstallComponent ApplicationName, "D:\Components\HappySecure.dll", "Security Functionality", 2, 4, -1, 4, 0, 0

'************************************************* *****************************
'Installs the Application
'************************************************* *****************************
'Activation (Activation type): 0 - The library, one-server
'AccessChecksLevel (Click the Security tab of the security level): 0 - Perform access checks only at the process level, one-process and component level access checks
'ApplicationAccessChecksEnabled (Click the Security tab of the authorization): 1-check (perform access checks for this application), 0 - eonchekeu (access checks for this application, None)
'Authentication (call level of authentication, the server type is only valid for): 1 - No 2 - connection, 3 - Call 4-packet, a 5-packet integrity, 6 - Packet Privacy
'ImpersonationLevel (the level): 1 - Anonymous, 2 - ID, 3 - the 4-delegate
'Identity: Interactive User - an interactive user, NT AUTHORITYLocalService - Local Service, NT AUTHORITYNetworkService - Network Services, then the user - ID type directly
' Reference: Application Level In all of the attribute
Sub InstallApplication (ApplicationName, ApplicationDescription, Authentication, Identity, Password, ImpersonationLevel)	
	Dim cat, collApps, app
	
	Set cat = CreateObject("COMAdmin.COMAdminCatalog")
	Set collApps = cat.GetCollection("Applications")
	collApps.Populate
	Set app = collApps.Add
	app.Value("Name") = ApplicationName
	app.Value("Description") = ApplicationDescription
	app.Value("Authentication") = 4
	app.Value("Identity") = Identity
	app.Value("Password") = Password
	'Activation-type setting (0 - library, 1-Server)
	app.Value ("Activation") = 1
	app.Value ("AccessChecksLevel") = 0
	app.Value ("ApplicationAccessChecksEnabled") = 0
	app.Value ("ImpersonationLevel") = ImpersonationLevel
	collApps.SaveChanges

End Sub
'************************************************* *****************************
'Uninstalls the Application
'************************************************* *****************************
Sub UninstallApplication (ApplicationName)
	Wscript.Echo "Unregistering the existing application ..."
	
	Dim cat, collApps, numApps, i
	
	Set cat = CreateObject ("COMAdmin.COMAdminCatalog")
	Set collApps = cat.GetCollection ("Applications")
	collApps.Populate
	numApps = collApps.Count
	
	For i = numApps - 1 To 0 Step -1
		If collApps.Item (i). Value ("Name") = ApplicationName Then
			collApps.Remove (i)
			WScript.echo "- Application" & ApplicationName & "removed!"
		End If
	Next
	collApps.SaveChanges
	
End Sub

'************************************************* *****************************
'Installs the Component
'************************************************* *****************************
'ApplicationDll: DLL path, people, including
'Transaction: 0 - Disabled, 1 - Not Supported, 2 - Supported, 3 - Required, 4 - Requires New
'TxIsolationLevel (transaction isolation level): 0 - All 1 - read uncommitted, 2-read-committed, and 3 - that you can repeat the reading, a 4-yeonsokdoem
'JIT: -1 - JIT enabled, use, 0 - JIT does not activated
'Synchonization: 0 - Disabled 1 - No 2 - Yes 3 - Required 4 - need saeteuraenjaeksyeon
' See also: component-level attribute that all
Sub InstallComponent (ApplicationName, ApplicationDLL, Description, Transaction, TxIsolationLevel, JIT, SYN, ComponentAccessChecksEnabled, ObjectPoolingEnabled)
	Dim cat, collApps, App, numApps, numComponents, i, j
	Dim components, component
	
	Set cat = CreateObject("COMAdmin.COMAdminCatalog")
	Set collApps = cat.GetCollection("Applications")
	collApps.Populate
	numApps = collApps.Count
	For i = numApps -1 To 0 Step -1
		'Wscript.Echo collApps.Item (i). Value ("Name")
		If collApps.Item (i).Value("Name") = ApplicationName Then
		Wscript.Echo App.Value("ID")
			Set App = collApps.Item(i)
			cat.InstallComponent App.Value("ID"), ApplicationDLL, "", ""			
		End If
	Next
End Sub

Sharing is caring

P.S. this wasn't the end all to getting the 32bit to work on x64. There was more but this was the best find.

NOTE TO SELF: SQL Find inactive DBs

/*
Find DB activity for known list of DBs

ALL CREDIT goes to:
http://sqlblog.com/blogs/aaron_bertrand/archive/2008/05/06/when-was-my-database-table-last-accessed.aspx

I merely tweaked for my own needs

-- You can adjust the script to select from sys.databases WHERE Name in (....). But 
-- as for me I like to keep a second listing in a management DB 

  CREATE TABLE [DBs]
    (
     [UID] [int] NOT NULL
                 IDENTITY(1, 1) NOT FOR REPLICATION
   , [DBID] [int] NULL
   , [DBName] [nvarchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS
                              NOT NULL
   , [Type] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS
                          NOT NULL
   , [DateCreated] [datetime]
        NOT NULL
        CONSTRAINT [DF_DBs_DateCreated] DEFAULT (GETDATE()))
  ON
    [PRIMARY]

*/
DECLARE
		@DBName VARCHAR(128) --Database name	  
	  , @SQL VARCHAR(8000)	 
	  , @DBCount INT
	  , @DBCounter INT

 IF OBJECT_ID('tempdb..#tmpDBs') IS NOT NULL 
		DROP TABLE #tmpDBs

IF OBJECT_ID('tempdb..##tmpDBActivity') IS NOT NULL 
		DROP TABLE ##tmpDBActivity

CREATE TABLE ##tmpDBActivity(DBName sysname,last_read DATETIME, last_write DateTime)

SELECT
		ROW_NUMBER() OVER (ORDER BY DBName ASC) IDX
	  , DBName 
	 INTO
		#tmpDBs
	 FROM
		ManageDBs.dbo.DBs
				
SELECT @DBCount = @@ROWCOUNT, @DBCounter = 1
WHILE @DBCounter <= @DBCount
	BEGIN
		SELECT @DBName = DBName FROM #tmpDBs Where IDX = @DBCounter	
		
		SELECT @SQL = '
USE ' + QUOTENAME(@DBName,'[') + '
;WITH  agg AS
(
    SELECT
        last_user_seek,
        last_user_scan,
        last_user_lookup,
        last_user_update
    FROM
        sys.dm_db_index_usage_stats
    WHERE
        database_id = DB_ID()
        AND OBJECT_SCHEMA_NAME([object_id]) = ' + QUOTENAME('dbo',CHAR(39)) + '
)
INSERT INTO ##tmpDBActivity
SELECT
	DB_NAME(DB_ID()) DBName
    ,last_read = MAX(last_read)
    ,last_write = MAX(last_write)
FROM
(
    SELECT  last_user_seek, NULL  FROM  agg
    UNION  ALL
    SELECT  last_user_scan, NULL  FROM  agg
    UNION  ALL
    SELECT  last_user_lookup, NULL  FROM  agg
    UNION  ALL
    SELECT  NULL, last_user_update FROM  agg
) AS  x (last_read, last_write);'
	EXEC (@SQL)
	SELECT @DBCounter = @DBCounter+1
	
	END

SELECT     
	DBName
  , last_read
  , last_write 
  , CASE WHEN last_read IS NULL AND last_write IS NULL 
		THEN 'INACTIVE' ELSE '' END STATUS
FROM 
	##tmpDBActivity	
ORDER BY last_read ASC

DROP TABLE ##tmpDBActivity

Results:

DBNamelast_readlast_writeSTATUS
CheeseAndRiceCoNULLNULLINACTIVE
ChickenButtLLCNULLNULLINACTIVE
FranksNBeansLTD2011-05-11 10:48:28.197NULL 
BobCo2011-06-09 10:46:30.923NULL 
BadSeafood2011-07-07 12:01:21.1372011-07-06 16:39:07.253 
ManageDBs2011-08-23 19:01:46.5102011-08-23 19:01:46.510


SQL Warm Standby Pulse, synced via LogShipping

--// SQL Warm Standby Pulse, synced via LogShipping
--// TODO: Create job to monitor age and send email alerts
--// ACKNOWLEDGED: yeah there's other built-in ways to accomplish this. 
DECLARE @THRESHOLD_HOURS INT
	
SELECT
    @THRESHOLD_HOURS = 8 ;
WITH    CTE
          AS (
              SELECT
                ROW_NUMBER() OVER (PARTITION BY rh.destination_database_name ORDER BY rh.restore_history_id DESC) Seq
              , rh.destination_database_name DBName
              , rh.restore_date LstRestoreDate
              , REVERSE(LEFT(REVERSE(physical_device_name),
                             CHARINDEX('\', REVERSE(physical_device_name)) - 1)) LogFileName
              , bs.backup_start_date LogFileDateCreated
              , bs.last_lsn
              FROM
                msdb.dbo.restorehistory rh (NOLOCK)
                LEFT JOIN msdb.dbo.backupset bs (NOLOCK) ON bs.backup_set_id = rh.backup_set_id
                LEFT OUTER JOIN msdb.dbo.backupmediafamily BMF ON BMF.media_set_id = BS.media_set_id
             )
    SELECT
        DBName
      , CASE WHEN LogFileDateCreated < DATEADD(hh, @THRESHOLD_HOURS * -1,
                                           GETDATE())
             THEN '> ' + LTRIM(STR(@THRESHOLD_HOURS)) + ' HOUR !!'
             ELSE ''
        END [ACHTUNG]
      , DATEDIFF(hh, LogFileDateCreated, GETDATE()) [AGE(HOURS)]
      , LstRestoreDate
      , LogFileName
      , LogFileDateCreated
      , last_lsn
    FROM
        CTE
    WHERE
        Seq = 1
    ORDER BY
        DBName