' This script adds, deletes, and sets state on adsi objects, as appropriate,
' based upon the value of the action parameter.
' It does some error checking...
' Only instance may be started, stopped, paused or resumed.
%>
<%
Const L_ACCESSDENIED_TEXT="Access Denied"
Const L_OBJEXISTS_ERR="An object with the name you specifed already exists. Specify a different object name."
Const L_UNKNOWN_ERR="An unknown error occured."
Const L_START_ERR="The service could not be started because it is not correctly configured. Make sure its server bindings do not conflict with other servers running on the same machine."
Const L_NOBINDINGS_ERR = "You must assign a binding to this site before starting."
Const L_STOP_ERR="The site could not be stopped at this time."
Const L_CONT_ERR="The site could not resume at this time."
Const L_PAUSE_ERR="The site could not be paused at this time."
Const L_DELETE_ERR="The object could not be deleted."
Const L_APPCREATE_ERR="The application could not be created."
Const L_APPREMOVE_ERR="The application could not be removed."
Const L_APPUNLOAD_ERR="The application could not be unloaded."
Const L_BACKUP_ERR = "The backup was not successful."
Const L_BACKUPRMV_ERR = "The backup was not deleted."
Const L_DEFAULTAPP_TEXT = "Default Application"
Const CSTART="2"
Const CSTOP="4"
Const CPAUSE="6"
Const CCONT="0"
Const MD_BACKUP_NEXT_VERSION = &HFFFFFFFF
%>
<HTML>
<%
On Error Resume Next
Dim action, path, vtype,stype,sel,pos,newADspath, dirname, keytype
Dim dirnamelen, baseobj, svc,key, keyname, newname, vdir, sname
Dim service, inst, nextinst, FileSystem, parenttype, newobj
Dim currentobj, rootobj, adminobj, objerr, delmetanode, bindings
Dim defaultinst, admininst, isolated,a
Dim bkupName,bkupVer, dirpath, delpath
action=Request.QueryString("a")
sel=Request.QueryString("sel")
path = Request.QueryString("path")
'save off our original action...
a = action
Select Case action
Case "add"
getTypes
Set FileSystem=CreateObject("Scripting.FileSystemObject")
if vtype="server" then
sname=Mid(path, 1, pos) & svc
Set service=GetObject(sname)
baseobj=service.ADsPath
For Each inst In service
if isNumeric(inst.name) then
Nextinst=inst.name
end if
Next
response.write nextinst
newname=Nextinst+1
end if
Set currentobj=GetObject(baseobj)
'if currentobj can't be set due to path not found,
'we need to set our parenttype var manually
if err <> 0 then
parenttype = ""
else
parenttype=currentobj.KeyType
end if
if Instr(parenttype,"Server") <> 0 then
baseobj=baseobj & "/Root"
Set currentobj=GetObject(baseobj)
parenttype=currentobj.KeyType
end if
'The physical directory may not currently
'exist in the metabase, so we have
'to find the parent vdir associated with
'the dir and build the path from there.
if (vtype="dir") then
Do Until Instr(parenttype, "VirtualDir") <> 0
'we need clear our path not found error..
err = 0
'add our initial whack...
newname = "/" + newname
'and cyle through the baseobj till we find the next whack,
'building up the path in new name as we go
Do Until Right(baseobj,1) = "/"
newname = Right(baseobj,1) & newname
baseobj = Mid(baseobj,1,Len(baseobj)-1)
Loop
'once we're out, we need to lop off the last whack...