WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Miscellaneous

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

WinPe ADSi Support


Man this took a while. I didn't have an immediate need so I didn't work on this that actively.... but someone had posted a need.

when I saw it a posted ADO / ADSI plugin for Bart's PEBuilder I promptly grabbed it and made a flat installer so you don't have to use Bart's. Really all the credit goes to the guy who did the time to find all the DLLs and what ones need to be registered.

You'll need the following:

Final note... Microsoft *still* doesn't "support" ADO / ADSI on WinPE so I wouldn't call them for issues. :)

ADD_SUPPORT.WBT

;-------------------------------------------------------------------------------------------------------------
; -= Adds ADSI and ADO Support to a WinPE Build Directory =-
; -= KK (Crypt) 2004 =-
;
; Script derived from the MsADO v3 PEbuilder plugin by Erwin Veermans
; http://www.veder.com/nwdskpe/#download
;
;
; ----> Important Note!!! <----
; This only copies the files.
; You'll need to add the autorun_MsAdo.cmd to your %WinPE%\System32\Startnet.cmd manually!!!!
; Just copy the autorun_MsAdo.cmd to %WinPE%\System32\ then edit the startnet.cmd and add "autorun_MsAdo.cmd"
; where you want it to run.
;
; ---> Important Note 2! <----
; This program assumes the files are being copied from a compressed source. If your files don't end in a _
; then you may have to modify it to use non-compressed files. It also requires expand.exe be in your path.
;
;-------------------------------------------------------------------------------------------------------------


;Fill in the paths below...
SourceDir="\\aasnap01\Standard\XP\xp_dist\I386" ;source. Do NOT use a trailing backslash
WinPEdir ="E:\WinPE" ;target. Do NOT use a trailing backslash
Log=StrCat(Environment("Temp"),"\","PEAdsi.log")


; Just a UDF to make pretty status boxes.
;==============================================================================
#DefineSubRoutine DialogCont(DialogTitle,Text,TitleBar)
;==============================================================================
         ; DialogCont: Like Dialog box but script continues processing. Box can be updated with new text / title
         ; Usage:DialogCont(Title of Box, Text for box, TitleBar on or off (0 or 1))
         ; Note: Title bar can not be turned on or off once it's initiated.
         ;
         ; RETURNS:  nothing
         ;
         ; Thanks to Author of Tech Article W14830 (unknown) for the DLL call to remove title bar
         ; Thanks to NVadnais for the core UDF
         ; - Crypt 2004

         If TitleBar==0 && IsDefined(BeenThereDoneThat)==0
            WinTitle("", "Hidden Window...")
            ; Remove title bar from main program window
            WS_CAPTION=12582912  ; Hex 00C00000  (Search MSDN for Q111011 for more parameter values)
            GWL_STYLE=-16
            MyWin=DllHwnd("Hidden Window...")
            User32=StrCat(DirWindows(1),"USER32.DLL")
            OldStyle=DllCall(User32, long:"GetWindowLongA", long:MyWin, long:GWL_STYLE)

            NewStyle=OldStyle & ~WS_CAPTION
            DllCall(User32, long:"SetWindowLongA", long:MyWin, long:GWL_STYLE, long:NewStyle)
         EndIf

         If IsDefined( BeenThereDoneThat )
            BoxDataClear(1, "FreshScreen" )

         Else
            BeenThereDoneThat = @TRUE

            ; draw initial splash screen
            BoxCaption(1,DialogTitle )

            ; box color is default windows gray
            BoxColor(1, "212,208,200", 0 )
            BoxDrawRect(1, "0,0,1000,1000", 2 )

            ; text color can be set below
            BoxTextColor( 1, "15,15,150" )
            If TitleBar==1
               BoxTextFont(1, "Tahoma", 220, 40, 0 )
               BoxesUp("350,450,650,550", @NORMAL )
            Else
               BoxTextFont(1, "Tahoma", 200, 40, 0)
               BoxesUp("350,460,650,540", @NORMAL )
            EndIf

            BoxDataTag(1, "FreshScreen" )

         EndIf

         BoxDrawRect(1, "10,10,1000,1000", 2 )
         BoxDrawText(1, "50,0,950,1000", Text, @FALSE, 1 | 4 | 16 )
         BoxCaption(1,DialogTitle )

         ;TimeDelay( .5 )

         Return

;==============================================================================
#EndSubRoutine
;==============================================================================


:Top
OutputLog=FileOpen(Log,"WRITE")
DialogCont("","Building List",0)

;------------------------------------------------
;copy files to %winpe%\I386\System32
;------------------------------------------------
   System32Target=StrCat(WinPEDir,"\I386\System32\")
   If !DirExist(System32Target)
      Message("Invalid WinPE Dir","Invalid WinPE dir. Please point to the root of your WinPE build directory")
      Goto End
   EndIf
   System32=""
   System32=ItemInsert(StrCat(System32Target,"clbcatq.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"cliconfg.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"cliconfg.exe"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"cliconfg.rll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"colbact.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"comres.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"comsvcs.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"dbmsrpcn.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"dbnetlib.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"dbnmpntw.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"ds16gt.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"ds32gt.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"expsrv.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"instcat.sql"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"mscpx32r.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"mscpxl32.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"msctf.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"msdart.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"msdatsrc.tlb"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"mslbui.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"msorc32r.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"msorcl32.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"mtxclu.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"odbcbcp.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"ole32.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"resutils.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"sqlsrv32.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"sqlsrv32.rll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"sqlunirl.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"vbajet32.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"Adsnt.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"Adsldp.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"Adsldpc.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"Adsmsext.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"Adsnds.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"Adsnw.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"Activeds.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"Activeds.tlb"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"Rassapi.dll"),-1,System32,@TAB)
   System32=ItemInsert(StrCat(System32Target,"Advpack.dll"),-1,System32,@TAB)
   ;dbmsadsn.dll ; removed by XPsp2 ?

;----------------------------------------------------------
;copy files to %WinPE%\Program Files\Common Files\System\Ole db
;----------------------------------------------------------
   OleTarget=StrCat(WinPEDir,"\Program Files\Common Files\System\Ole db\")
   If !DirExist(OleTarget) Then DirMake(OleTarget)
   OleDB=""
   OleDB=ItemInsert(StrCat(OleTarget,"msdadc.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdaenum.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdaer.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdaora.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdaorar.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdaosp.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdasc.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdasql.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdasqlr.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdatl3.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdatt.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msdaurl.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"msxactps.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"oledb32.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"oledb32r.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"sqloledb.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"sqloledb.rll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"sqlxmlx.dll"),-1,OleDB,@TAB)
   OleDB=ItemInsert(StrCat(OleTarget,"sqlxmlx.rll"),-1,OleDB,@TAB)

;----------------------------------------------------------
;copy files to %WinPE%\Program Files\Common Files\System\ado
;----------------------------------------------------------
   AdoTarget=StrCat(WinPEDir,"\Program Files\Common Files\System\ado\")
   If !DirExist(AdoTarget) Then DirMake(AdoTarget)
   Ado=""
   Ado=ItemInsert(StrCat(AdoTarget,"msader15.dll"),-1,Ado,@TAB)
   Ado=ItemInsert(StrCat(AdoTarget,"msado15.dll"),-1,Ado,@TAB)
   Ado=ItemInsert(StrCat(AdoTarget,"msado20.tlb"),-1,Ado,@TAB)
   Ado=ItemInsert(StrCat(AdoTarget,"msado21.tlb"),-1,Ado,@TAB)
   Ado=ItemInsert(StrCat(AdoTarget,"msado25.tlb"),-1,Ado,@TAB)
   Ado=ItemInsert(StrCat(AdoTarget,"msado26.tlb"),-1,Ado,@TAB)
   Ado=ItemInsert(StrCat(AdoTarget,"msadomd.dll"),-1,Ado,@TAB)
   Ado=ItemInsert(StrCat(AdoTarget,"msador15.dll"),-1,Ado,@TAB)
   Ado=ItemInsert(StrCat(AdoTarget,"msadox.dll"),-1,Ado,@TAB)
   Ado=ItemInsert(StrCat(AdoTarget,"msadrh15.dll"),-1,Ado,@TAB)
   Ado=ItemInsert(StrCat(AdoTarget,"msjro.dll"),-1,Ado,@TAB)

;----------------------------------------------------------
;copy files to %WinPE%\Program Files\Common Files\System\msadc
;----------------------------------------------------------
   MsadcTarget=StrCat(WinPEDir,"\Program Files\Common Files\System\msadc\")
   If !DirExist(MsadcTarget) Then DirMake(MsAdcTarget)
   Msadc=""
   Msadc=ItemInsert(StrCat(msadcTarget,"msadce.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msadcer.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msadcf.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msadcfr.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msadco.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msadcor.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msadcs.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msadds.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msaddsr.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msdarem.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msdaremr.dll"),-1,Msadc,@TAB)
   Msadc=ItemInsert(StrCat(msadcTarget,"msdfmap.dll"),-1,Msadc,@TAB)


BigList=StrCat(System32,@TAB,OleDB,@TAB,Ado,@TAB,msadc)

Failed=""
Count=ItemCount(BigList,@TAB)
For x = 1 To Count
   Target=ItemExtract(x,BigList,@TAB)
   Src=ItemExtract(-1,Target,"\")
   FileLen=StrLen(Src)
   Src=StrSub(Src,1,FileLen-1)
   Src=StrCat(Src,"_")
   Src=StrCat(SourceDir,"\",Src)
;   Message(Src,Target)
   If !FileExist(Src)
      FileWrite(OutputLog,StrCat("Source File Not Found: ",Src))
   Else
      params=StrCat('"',Src,'"'," ",'"',Target,'"')
      FileWrite(OutPutLog,StrCat("Expanding File: ",Src," To: ",Target))
      DialogCont("",StrCat("Expanding File: ",Src),0)
      ErrorMode(@OFF)
      rhw=RunHideWait("Expand.exe",params)
      If rhw!=1
         Message("Error","This program requires Microsoft's Expand.exe. Please put it in the path")
         Goto End
      EndIf
      ErrorMode(@CANCEL)
   EndIf
Next


:End
FileClose(OutputLog)
;Run("Notepad.exe",Log)
AUTORUN_MSADO.CMD
@echo off
Title Installing ADO Support
rem
rem AutoRun file to auto-install ADO Support for WinPE
rem
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\msadc\msadce.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\msadc\msadcf.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\msadc\msadco.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\msadc\msadds.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\ado\msado15.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\ado\msadomd.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\ado\msador15.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\ado\msadoX.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\ado\msadrh15.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\msdadc.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\msdaenum.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\msdaer.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\msdaora.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\msdaosp.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\msadc\msdarem.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\msdasc.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\msdasql.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\msdatt.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\msdaurl.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\msadc\msdfmap.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\ado\msjro.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\msxactps.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\oledb32.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\oledb32r.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\sqloledb.dll" /S
%SystemRoot%\System32\Regsvr32.exe "%SystemDrive%\Program Files\Common Files\System\Ole DB\sqlxmlx.dll" /S
%SystemRoot%\System32\Regsvr32.exe %SystemRoot%\System32\msorcl32.dll /S
%SystemRoot%\System32\Regsvr32.exe %SystemRoot%\System32\odbcconf.dll /S
%SystemRoot%\System32\Regsvr32.exe %SystemRoot%\System32\CLBCATQ.DLL /S
%SystemRoot%\System32\Regsvr32.exe %SystemRoot%\system32\colbact.DLL /S
%SystemRoot%\System32\Regsvr32.exe %SystemRoot%\system32\comsvcs.dll /S
%SystemRoot%\System32\Regsvr32.exe %SystemRoot%\System32\MSCTF.dll /S
%SystemRoot%\System32\Regsvr32.exe %SystemRoot%\System32\mslbui.dll /S
%SystemRoot%\System32\Regsvr32.exe %SystemRoot%\system32\ole32.dll /S
%SystemRoot%\System32\Regsvr32.exe %SystemRoot%\system32\activeds.dll /S
EXIT

Article ID:   W17050
File Created: 2007:07:03:14:27:54
Last Updated: 2007:07:03:14:27:54