Persist dynamic data through driver restarts

I have a SOAP driver that I wrote back in 2010 that I currently use for account creation in eDirectory from some internal applications. One of the account types it creates are service accounts and our naming convention is an alpha prefix with a 5 digit number that is incremented for each account created for the username. I have the below action using the unique name token to iterate through the existing accounts to find the first number that is not used. There definitely may be much better ways to do this but I wrote this as one of my first drivers so I am sure there are a lot of things in there that can be done better. :D

The problem I have with this solution is I use a GCV to contain the starting point to start incrementing from since we don't won't to reuse any accounts. Since it is a GCV, that means I have to manually update the value every so often and restart the driver so we don't end up reusing an account that was deleted. What I am wondering is if there is somewhere else I can store a counter that can be read/written to from policy that will not be lost on a driver restart. I see there is a DirXML-PersistentData attribute on the drivers that it appears the drivers read/write to so not sure if there is a way to read/write to that location in policy or if there is somewhere else better suited for this purpose. If there is somewhere that I could write to from policy then I could store the number in their so it will always have the last account number that was created and I wouldn't have to use the unique name token to loop through to find the next open number.

Thanks in advance.

<token-unique-name counter-digits="5" counter-pad="true" counter-pattern="first" counter-start="~XX-start-counter~" counter-use="always" name="uniqueID" on-unavailable="error" scope="subordinates">
<token-text xml:space="preserve">\</token-text>
<token-global-variable name=""/>
<token-text xml:space="preserve">\</token-text>
<token-map dest="RDN" src="Account_Type" table="..\..\Mapping Tables\Account Types Table">
<token-local-variable name="accounttype"/>
<token-local-variable name="accounttype"/>
Parents Reply Children
No Data