Yeah, I didn't think to add a "delay" in there to keep Unity off line for a set period of time before bringing it back up - that wouldn't be too difficult to add. I'll do that the next time I crack it open.
I pulled some of the code out for the actual shut down and startup process - the thing about taking Unity down is doing things in the right order - if you go right for the AvCsMgr she'll kick on you... you have to sneak up on her.
This needs to work for all versions and configurations of Unity so it includes some services that may or may not be on the box (i.e. the Bridge Connector service) thats OK, itll just blow through them.
I first stop Unity using the gateway this requires a COM interface which you wont be able to do via a script this just means any active calls get terminated rudely. Other than that there's no reason this can't be done in script just fine.
==================
"Net Stop AvDirChangeWriter
"Net STop AvDSGlobalCatalog"
"Net Stop AvCsGateway"
"Net Stop AvcsMgr"
"Net Stop AvDSAD"
Net Stop AvDSGlobalCatalog"
Net Stop AvGAENsvr"
"Net Stop csBridgeConnector"
"Net Stop AvMsgStoreMonitorSvr"
"Net Stop AvRepDirSvrSvc"
Net Stop AvUMRSyncSvr"
"Net Stop AvTTSSvr"
'now use kill to make sure we take EVERYTHING off line this also takes the tray status icon out which is important since if you dont kill that itll start the gateway up again on its own its very persistent. The f means force here in case any service decides not to go quietly. Insert the proper path here.
"c:\commserver\kill.exe f av*.*"
OK, everythings off line so. The next section is the startup sequence.
"Net Start AvCsGateway"
"Net Start AvDSAD"
"Net Start AvDSGlobalCatalog"
"Net Start AvGAENSvr"
"Net Start AvDirChangeWriter"
"Net Start AvMsgStoreMonitorSvr"
"Net Start AvLic"
"Net Start AvUMRSyncSvr"
"Net Start AvTTSSvr"
"Net Start AvRepDirSvrSvc"
'Start tray icon again insert the appropriate path name here
Shell c:\commserver\AvCsTrayStatus.exe"
Unity should be back up and running