powered by Jive Software

I'm trying to create a script to...(spark.properties)

I’m trying to create a script to auto-generate the %USERNAME%/Spark folder, encrypt it, and then create the spark.properties file in it. The desired result is that when we install Spark to our users, we can also automatically set up their account for them (fill in the server name, etc.)

I’ve pretty much got it down but there is one bug that’s…bugging me. Once the folder and file are created, I log into spark. It fills in the username, server name, etc, logs in, and populates the contact list, but it won’t send out messages. It can receive them, but won’t send them out.

However, after logging out and logging back in it works perfectly fine.

So, there is something different about this initial log in and the second time. Does anyone have any idea what this could be/where it is located? Anyone else try scripting something like this before?

Here is the scripting code:

IF NOT EXIST “%userprofile%\Spark” goto :BUILDSPARK
goto :ENCRYPTSPARK

:BUILDSPARK
mkdir “%userprofile%\Spark"
cipher.exe /E /S:”%userprofile%\Spark" /A
CD “%USERPROFILE%\Spark"
SET SPARKPREFS=”%USERPROFILE%\Spark\spark.properties"

ECHO password= >> %SPARKPREFS%
ECHO timeDisplayed=true >> %SPARKPREFS%
ECHO offlineGroupVisible=true >> %SPARKPREFS%
ECHO notifyOnOnline=false >> %SPARKPREFS%
ECHO username=%USERNAME% >> %SPARKPREFS%
ECHO windowTakesFocus=false >> %SPARKPREFS%
ECHO toasterPopup=false >> %SPARKPREFS%
ECHO autoLoginEnabled=false >> %SPARKPREFS%
ECHO showHistory=true >> %SPARKPREFS%
ECHO checkForBeta=false >> %SPARKPREFS%
ECHO showEmptyGroups=false >> %SPARKPREFS%
ECHO tabsOnTop=true >> %SPARKPREFS%
ECHO notifyOnOffline=false >> %SPARKPREFS%
ECHO server=mychat >> %SPARKPREFS%
ECHO chatNotificationOn=true >> %SPARKPREFS%
ECHO passwordSaved=false >> %SPARKPREFS%
ECHO buzzEnabled=true >> %SPARKPREFS%
ECHO spellCheckerEnabled=true >> %SPARKPREFS%
ECHO defaultChatLengthTimeout=15 >> %SPARKPREFS%

:ENCRYPTSPARK
cipher.exe /E /S:"%userprofile%\Spark" /A

I am using an msi that I built. I have replaced the shortcut that gets installed for a shortcut that points to my script, which starts spark, here is my script:

REM *** Sync time to a DC to refresh Kerberos Ticket
net time

REM *** Check to see if this has already been ran
if exist “userprofile%\Spark\setup1.0.txt” goto setup

REM *** Check to see if SSO has already been configured
if exist “%userprofile%\Spark\spark.properties.backup” goto startup

REM *** Check to see if this user has started the IM client
if exist “%userprofile%\Spark\spark.properties” goto sso

REM *** IM either hasn’t started up or isn’t installed, need to configure SSO for first time user if installed
if exist “c:\Program Files\Spark\spark.properties” goto firsttime

REM *** IM isn’t installed on this computer.
goto nospark

:firsttime
mkdir "%userprofile%\Spark"
copy “c:\Program Files\Spark\spark.properties” "%userprofile%\Spark"
goto startup

:sso
move “%userprofile%\Spark\spark.properties” "%userprofile%\Spark\spark.properties.backup"
copy “c:\Program Files\Spark\spark.properties” "%userprofile%\Spark"
goto startup

:startup
REM ***This checks whether or not the user has it in startup
REM if exist “%userprofile%\Spark\startupprompted.1.0.txt” goto setup
"c:\program files\Spark\scripts\imstartup.vbs"
echo Properly setup with SSO >"%userprofile%\Spark\setup1.0.txt"

:setup
start “” “C:\Program Files\Spark\Spark.exe”

:nospark
exit

obviously I am doing a little more than you are. but this way my spark.properties file will get setup for a user regardless of if they are the only one of the machine. I use a known good and working spark.properties file to copy to the users.

and using %userprofile% makes it work for xp and vista and this sets up my sso, sync kerb ticket for vpn users

in looking back at your post, why are you using cipher, maybe thats why it doesn’t work at first, its encryped and maybe thats giving some problems for the first run.