oAdminCatalog = createobject("COMAdmin.COMAdminCatalog")
oAdminCatalog.connect("myserver")
oApplications = oAdminCatalog.GetCollection("Applications")
oApplications.Populate()
procedure CreateApplication(cAppName as string) as Boolean
local oNewApp as COMAdmin.COMAdminCatalogObject
oNewApp = oApplications.add()
oNewApp.value("Name") = cAppName
oApplications.SaveChanges()
Populate()
endproc
procedure AddComponentToApplication ;
(cAppName as string, cDLLPath as string, ;
cTypeLibraryPath as string, cDLLProxy as string) as long
* We aren't using proxy stub DLLs (the 4th parameter)
nReturnValue = oAdminCatalog.InstallComponent(cAppName, cDLLPath, cTypeLibraryPath, "")
if isnull(nReturnValue) or nReturnValue = 0
lFailed = .f.
else
lFailed = .t.
endif
return not lFailed
endproc
procedure SetIdentity (cDomainUserName as string, cPassword as string) as Boolean
local lFailed as Boolean
for each oApp in colApplications
if lFailed
exit
endif
* Configure applications to use a specific account
* An error will be raised if username or password is invalid.
try
oApp.value("Identity") = cDomainUserName
oApp.value("Password") = cPassword
* Note this uses the SaveChanges method of the collection, not the app itself
oApplications.SaveChanges()
? "Set identity for " + oApp.name
catch to oException
if oException.errorno = 1426 and left(oException.details, 8) = "80110414"
messagebox("Either the supplied username or password is not correct.")
else
messagebox("Unexpected error " + transform(oException.errorno) + " setting identity for " + oApp.name)
endif
lFailed = .t.
endtry
next
return not lFailed
endproc