SSO script for spark 2.8.1 spark.properties file with openfire server 4.0.3

Hello All,

So I have setup a linux openfire server with SSO capabilities and now need to deploy the spark.properties file to all my staff so they can have sso setup upon login to their workstations. I have already tried various approaches to this and it seems that manual setup is the only working option. It seems any time I execute a batch to modify the spark.properties it then defaults to deselecting SSO check box the next time the program is opened also it will not allow me to click the Advanced button to check SSO again without deleting the spark.properties file and allowing a new one to be created at next program start. From what i can tell the file has 2 states one when freshly generated and sso has been turned on then it adds a ton of values after the initial successful login with sso see below for the 2 different states. Finally below those examples i will post a sample .bat config that I have tried which give me the issues mentioned above.

Pre-login file state:

#Spark Settings

#Wed Nov 02 09:24:59 EDT 2016

jksPath=

compressionOn=false

resource=Spark

useVersionAsResource=false

trustStorePath=

hostAndPort=true

DisableHostnameVerification=false

timeout=10

xmppPort=5222

useHostnameAsResource=false

debuggerEnabled=false

protocol=SOCKS

proxyPassword=

xmppHost=im.postcardmania.com

proxyEnabled=false

trustStorePassword=

ssoMethod=file

AcceptAllCertificates=true

pkiEnabled=false

proxyUsername=

sslEnabled=false

ssoEnabled=true

pkiStore=JKS

saslGssapiSmack3compat=false

Post-Login file state:

#Spark Settings

#Wed Nov 02 09:27:21 EDT 2016

pkiStore=JKS

saslGssapiSmack3compat=false

proxyUsername=

tabsOnTop=true

trustStorePassword=

useHostnameAsResource=false

checkForBeta=false

stunFallbackHost=

useVersionAsResource=false

audioDevice=wasapi:{0.0.1.00000000}.{359964cc-f431-4a28-a335-3cf38bcab41d}

isShowingRoleIcons=false

lastUpdateCheck=1478093239446

defaultChatLengthTimeout=15

audioSystem=wasapi

pkiEnabled=false

DisplayTime=1000

showPrevHistory=true

AvailableCodecs=

notifyOnOffline=false

isMucHighNameOn=false

AcceptAllCertificates=true

autoAcceptMucInvite=false

offlineGroupVisible=true

showOfflineUsers=false

DisableHostnameVerification=false

compressionOn=false

isMucRandomColors=true

protocol=SOCKS

xmppPort=5222

SystemTrayNotificationEnabled=false

sslEnabled=false

autoLoginEnabled=false

HISTORY_SORT_DATEASC=true

trustStorePath=

notifyOnOnline=false

chatNotificationOn=true

disableAsteriskToasterPopup=false

videoDevice=directshow:TOSHIBA Web Camera - MP

playbackDevice=wasapi:{0.0.0.00000000}.{3466fb61-d692-4ba5-8bbc-0b3ef51f61fd}

useAdHocRoom=true

passwordSaved=false

resource=Spark

toasterPopup=false

showHistory=true

showTypingNotification=false

username=isaiahcoughlin

ssoEnabled=true

timeFormat=HH:mm

ssoMethod=file

hostAndPort=true

server=im.postcardmania.com

showEmptyGroups=false

jksPath=

stunFallbackPort=3478

buzzEnabled=true

xmppHost=im.postcardmania.com

isMucHighToastOn=false

SelectedCodecs=ALAW/rtp^ULAW/rtp^gsm/rtp^g723/rtp^

isShowJoinLeaveMessagesOn=true

timeout=10

proxyEnabled=false

loginAsInvisibleEnabled=false

windowTakesFocus=false

isMucHighTextOn=false

debuggerEnabled=false

timeDisplayed=true

proxyPassword=

Failing batch config:

echo #Spark Settings > %AppData%\Spark\spark.properties

echo #Wed Nov 02 09:12:06 EDT 2016 >> %AppData%\Spark\spark.properties

echo resource=Spark >> %AppData%\Spark\spark.properties

echo hostAndPort=true >> %AppData%\Spark\spark.properties

echo server=im.postcardmania.com %AppData%\Spark\spark.properties

echo xmppPort=5222 >> %AppData%\Spark\spark.properties

echo protocol=SOCKS >> %AppData%\Spark\spark.properties

echo xmppHost=im.postcardmania.com >> %AppData%\Spark\spark.properties

echo ssoMethod=file >> %AppData%\Spark\spark.properties

echo AcceptAllCertificates=true >> %AppData%\Spark\spark.properties

echo sslEnabled=false >> %AppData%\Spark\spark.properties

echo ssoEnabled=true >> %AppData%\Spark\spark.properties

echo pkiStore=JKS >> %AppData%\Spark\spark.properties

echo saslGssapiSmack3compat=false >> %AppData%\Spark\spark.properties