powered by Jive Software

Modifying all user settings across network

Some say it can’t be done, some say it can, some people don’t bother to check, some say potatoe some prefer fries.

The network setup here is a simple peer to peer based network of 90 users. We are using Spark 2.5.8.

To ensure network consistency of certain items we’ve implemented a startup batch file that points to a network batch file which can be branched off for our purposes. If you have a domain based setup on Windows then you can use the existing batch setup.

Problem 1, there are multiple users per machine. How do we garuntee that each user gets their profile updated without having to run the entire process at each boot?.. Answer: at the end of each batch file that is run, have it output a txt file in a subfolder that is created by the users profile name variable. Then at some point before you call the spark specific batch file, have it check to see if this file exists or not. If it does, ignore that spark batch file, if it doesn’t, run the spark batch file. You can put timestamps in the name if you want to update with revisions.

Problem 2, we can’t update the spark settings while it’s running and the batch file may or may not run before spark starts on startup… Answer, as a part of the batch file give time enough for spark to be open for sure, then kill it, do the update, then have it reopen.

Problem 3, there are variables specific to each user, their name, password and download location. If I overwrite the settings file with something generic they’ll have to enter all their info again. Answer: use findstr to suck out the important stuff, then echo to put the other stuff in.

Here is the contents of the batch file I use.

REM
REM Spark Settings
REM

IF NOT EXIST “C:\Program Files\Spark\Spark.exe” EXIT

IF NOT EXIST “%WINDIR%\SYSTEM32\PSKILL.EXE” COPY /Y “Q:\laninfo\Batch\Files\PSKILL.EXE” "%WINDIR%\SYSTEM32\PSKILL.EXE"
IF NOT EXIST “%WINDIR%\SYSTEM32\PSEXEC.EXE” COPY /Y “Q:\laninfo\Batch\Files\PSEXEC.EXE” "%WINDIR%\SYSTEM32\PSEXEC.EXE"
REM Registry entry for accepting PSKILL and PSEXEC EULAs without user prompt.
REGEDIT /s “Q:\laninfo\Batch\Files\pskill_user.reg”

@echo off

PING 127.0.0.1 -n 5
PING 127.0.0.1 -n 5
PING 127.0.0.1 -n 5
PING 127.0.0.1 -n 5
PING 127.0.0.1 -n 5
PING 127.0.0.1 -n 5

net send %computername% Updating Spark Spark will re-open when complete. Click “OK” to close this notice.
if errorlevel 1 GOTO ENABLESERVICE

:ENABLESERVICE
sc config messenger start= auto
PING 127.0.0.1 -n 5
sc start messenger
PING 127.0.0.1 -n 5

net send %computername% Updating Spark Spark will re-open when complete. Click “OK” to close this notice.
PING 127.0.0.1 -n 5
sc stop messenger
PING 127.0.0.1 -n 5
sc config messenger start= disabled

pskill -t spark.exe

copy /Y “%userprofile%\spark\spark.properties” "c:\batch\files\spark.txt"
copy /Y “Q:\laninfo\Spark\sound-settings.xml” “%UserProfile%\Spark\sound-settings.xml”

findstr /x “password=.* username=.* downloadDirectory=.*” “C:\batch\files\spark.txt”>"C:\batch\files\spark2.txt"
echo emoticonPack=Default>> "C:\batch\files\spark2.txt"
echo idleTime=3>> "C:\batch\files\spark2.txt"
echo idleOn=true>> "C:\batch\files\spark2.txt"
echo timeDisplayed=true>> "C:\batch\files\spark2.txt"
echo offlineGroupVisible=true>> "C:\batch\files\spark2.txt"
echo notifyOnOnline=false>> "C:\batch\files\spark2.txt"
echo lastUpdateCheck=1257831265015>> "C:\batch\files\spark2.txt"
echo contactListFontSize=14>> "C:\batch\files\spark2.txt"
echo windowTakesFocus=false>> "C:\batch\files\spark2.txt"
echo contactListIconSize=24>> "C:\batch\files\spark2.txt"
echo toasterPopup=true>> "C:\batch\files\spark2.txt"
echo timeout=10>> "C:\batch\files\spark2.txt"
echo xmppPort=5222>> "C:\batch\files\spark2.txt"
echo autoLoginEnabled=true>> "C:\batch\files\spark2.txt"
echo showHistory=true>> "C:\batch\files\spark2.txt"
echo checkForBeta=false>> "C:\batch\files\spark2.txt"
echo showEmptyGroups=false>> "C:\batch\files\spark2.txt"
echo tabsOnTop=false>> "C:\batch\files\spark2.txt"
echo startOnStartup=true>> "C:\batch\files\spark2.txt"
echo chatRoomFontSize=16>> "C:\batch\files\spark2.txt"
echo showAvatar=false>> "C:\batch\files\spark2.txt"
echo notifyOnOffline=false>> "C:\batch\files\spark2.txt"
echo server=10.222.190.204>> "C:\batch\files\spark2.txt"
echo chatNotificationOn=true>> "C:\batch\files\spark2.txt"
echo startHidden=true>> "C:\batch\files\spark2.txt"
echo fileTransferTimeout=30>> "C:\batch\files\spark2.txt"
echo passwordSaved=true>> "C:\batch\files\spark2.txt"
echo buzzEnabled=true>> "C:\batch\files\spark2.txt"
echo emoticonsEnabled=true>> "C:\batch\files\spark2.txt"
echo spellCheckerEnabled=false>> "C:\batch\files\spark2.txt"
echo defaultChatLengthTimeout=15>> "C:\batch\files\spark2.txt"
echo useSystemLookAndFeel=true>> “C:\batch\files\spark2.txt”

copy /Y “c:\batch\files\spark2.txt” “%userprofile%”\spark\spark.properties"
REM
REM Delete unneeded addons
REM
del "C:\Program Files\Spark\plugins\jingle.jar"
del "%userprofile%\Spark\plugins\jingle.jar"
REM
REM
REM Delete unneeded emoticons
REM
del /Q "C:\Program Files\Spark\xtra\emoticons*.*"
rmdir /S /Q "%userprofile%\Spark\xtra\emoticons\GTalk.AdiumEmoticonset"
rmdir /S /Q "%userprofile%\Spark\xtra\emoticons\POPO.adiumemoticonset"
rmdir /S /Q "%userprofile%\Spark\xtra\emoticons\sparkEmoticonSet"
del "%userprofile%\Spark\xtra\emoticons\Default.adiumemoticonset.zip"
del "%userprofile%\Spark\xtra\emoticons\GTalk.AdiumEmoticonset.zip"
del "%userprofile%\Spark\xtra\emoticons\POPO.adiumemoticonset.zip"
del "%userprofile%\Spark\xtra\emoticons\sparkEmoticonSet.zip"
REM rmdir /S /Q "%userprofile%\Application Data\Spark\xtra\emoticons\GTalk.AdiumEmoticonset"
REM rmdir /S /Q "%userprofile%\Application Data\Spark\xtra\emoticons\POPO.adiumemoticonset"
REM rmdir /S /Q "%userprofile%\Application Data\Spark\xtra\emoticons\sparkEmoticonSet"
REM del "%userprofile%\Application Data\Spark\xtra\emoticons\Default.adiumemoticonset.zip"
REM del "%userprofile%\Application Data\Spark\xtra\emoticons\GTalk.AdiumEmoticonset.zip"
REM del "%userprofile%\Application Data\Spark\xtra\emoticons\POPO.adiumemoticonset.zip"
REM del "%userprofile%\Application Data\Spark\xtra\emoticons\sparkEmoticonSet.zip"
REM
REM
REM Replace audio file for incoming message
REM
copy /Y “Q:\laninfo\Spark\incoming.wav” "C:\Program Files\Spark\resources\sounds\incoming.wav"
REM
REM
REM Copy custom emoteicons to client unit
REM
mkdir "%userprofile%\Spark\xtra\emoticons\Default.adiumemoticonset"
xcopy /E /C /R /H /K /Y “Q:\laninfo\Spark\Default.adiumemoticonset” "%userprofile%\Spark\xtra\emoticons\Default.adiumemoticonset"
REM mkdir "%userprofile%\Application Data\Spark\xtra\emoticons\Default.adiumemoticonset"
REM xcopy /E /C /R /H /K /Y “Q:\laninfo\Spark\Default.adiumemoticonset” "%userprofile%\Application Data\Spark\xtra\emoticons\Default.adiumemoticonset"
REM
REM
REM Update date file to note/trigger new deployment
REM Be sure to update the date of the output file below
REM as well as update it in universal.bat in the correct
REM area. Use todays date as the counter.
REM
psexec -d “C:\Program Files\Spark\Spark.exe”

ECHO >>c:\batch\logs%UserName%\spark_settings_111009.txt
REM
REM
exit

Is this your login script? where/when do you have this run. Thanks!

I’ve attached the batch files used to start this process… I’ve added them as txt files so that they don’t run afoul of any AV programs or strict security settings.

Locations:

C:\Batch\Check_settings.bat (this starts everything, there is a shortcut in the startup folder which starts it)

Check_settings.bat points to Q:\laninfo\Batch\universal.bat (universal.bat is the area where I add or remove various routines, including spark)

The Q:\ drive is a mapped drive letter to a network share.

universal.bat calls other batch files including the spark_settings.bat.

Instead of updating batch files on each computer, this method has just one batch file on each computer which runs a 2nd batch file on the network. This way I only have to modify and verify things at one location.

From there you should be able to deduce the structure, or get the jist of it and implement a different way of doing it.

Let me know if you have any questions.

Thanks,

Jacob
Check_Settings.txt.zip (253 Bytes)
universal.txt.zip (948 Bytes)
spark_settings.txt.zip (1591 Bytes)

You should probably convert this thread into a document.