Disabling agents programatically

I am creating a archive db from an existing db and want to disable any scheduled agents in the archive db programatically. Here is the code and I get an Error 4461 Cannot disable manual agent message when it gets to the line “a.IsEnabled = False”.

Set db = s.currentdatabase

dbpath = db.FilePath 'set the path of the current db

Set ArchiveDb = db.CreateCopy(“”,dbpath + dateStr + “Tires.nsf”) 'create new database

ArchiveDb.Title = dateStr + " Tires" 'need the db to follow the year and dbname format that is crrently being used by all archived databases

'disable all agents in archive db

Forall a In archiveDb.Agents

	If a.IsEnabled Then	

		Print a.name

		a.IsEnabled = False

		Call a.save(True,True)

	End If

End Forall

'format the replica ID to follow the 00000000:00000000 format by adding the colon

ArchRepID = ArchiveDb.ReplicaID

I have also tried the code ang et same results:

'disable all agents in archive db

Forall a In archiveDb.Agents

	If Not a.IsActivatable Then	

		Print a.name

		a.IsEnabled = False

		Call a.save(True,True)

	End If

End Forall

Mike

Subject: disabling agents programatically

use the Trigger property of NotesAgent to check the type of agent and skip it if it’s not a trigger type that runs on a schedule.

Subject: disabling agents programatically

Since it is an archive database, why not just remove the agents completely?

Forall a In archiveDb.Agents

a.Remove

End Forall

Subject: RE: disabling agents programatically

Thanks - This is the route I took.