Have you considered implementing a Caché source code management tool such as Deltanji from George James Software, for whom I work? A Deltanji workflow can propagate code from one namespace to another, and can also propagate deletions. In other words, if you decommission a class in DEV, then propagate the now-decommissioned code object to TEST, the class will be deleted from TEST.

If you don't mind working a the global level, here's a way of enumerating the classes that are stored in the default code database of a namespace:

USER>s namespace="%SYS"                                                          
USER>s impliedNamespace="^"_##class(%SYS.Namespace).GetGlobalDest(namespace,"^oddDEF")
USER>w impliedNamespace
USER>s className="" f  s className=$o(^|impliedNamespace|oddDEF(className)) q:className=""  w !,className

By looking at the code of the InstanceGUID method in the %SYS.System class we can see where it's stored:

/// Returns instance GUID.
/// <br>
/// An instance GUID is a 16 byte (128 bit) globally unique identifier, assigned per instance of Cache installation.
ClassMethod InstanceGUID() As %String
    s ns="^^"_$zu(12)
    if ('$d(^[ns]SYS("INSTANCEGUID"))) Set ^[ns]SYS("INSTANCEGUID")=$system.Util.CreateGUID()

It's in ^SYS("INSTANCEGUID") in the CACHESYS database.

USER>w ##class(%SYS.System).InstanceGUID()
USER>w $zv
Cache for Windows (x86-32) 2016.2.1 (Build 803U) Wed Oct 26 2016 13:33:05 EDT

However I don't know what might happen if you change it. Best check with InterSystems.

Your reference to LocalSystem means I assume you're running Cache on Windows. On this platform Cache processes started by Cache (e.g. telnet logins, web application handlers, Studio connections) will run at the OS level as whatever Windows account the Cache service is set to log on as (see Windows service control manager tab as shown below).

If you make your Cache service run as a specific account rather than as Local System, then all of the processes started by Cache will run with those credentials.

I don't know if this will help you.

UPDATE: Starting at 2015.2 (I think), it is important to use the cinstall.exe utility (located in your installation's bin subdirectory) to change which account the service runs as:

cinstall setserviceusername <InstanceName> <username> <password>

If you don't do this but instead only  change the setting in the Log On tab of the service (screenshot above), then in certain circumstances the $ZF() functions may return a -1 failure code. See http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=... Search the docs for "setserviceusername" for more details.

If you're trying to check that the first character is " then you need to double the quotes. In other words, test as follows:

if $e(chunk,1,1)=""""

Maybe adding the /recursive=1 qualifier will give you what you want. If so, please click the checkmark to accept this answer.

SAMPLES>d $system.OBJ.Export("Cinema.Film.cls","c:\s\exp1.xml")                  
Exporting to XML started on 04/13/2017 09:49:36
Exporting class: Cinema.Film
Export finished successfully.
SAMPLES>d $system.OBJ.Export("Cinema.Film.cls","c:\s\exp2.xml","/recursive=1")   
Exporting to XML started on 04/13/2017 09:49:39
Exporting class: Cinema.Duration
Exporting class: Cinema.Film
Exporting class: Cinema.FilmCategory
Export finished successfully.

Launch an admin-level command window, then run csession.exe in the bin directory of your Caché install, giving your instance name as the argument, e.g.

If this works for you please click the checkmark alongside the answer.

Are you aware of the ChangePassword method of %SYSTEM.Security? You can call it from the $system SVN, i.e. something like:

set blnOK=$system.Security.ChangePassword($username,newPW,oldPW,.status)

If blnOK is false there should be more information in status.

Since the issue no longer exists I'm adding this "answer", and then accepting it, in order to remove it from the "unanswered" and "no answer" lists.

Now we can, I'm adding this "answer", and then accepting it, in order to remove it from the "unanswered" and "no answer" lists.