'============================================================================================================

sScriptTitle	= "Adjust Current User settings"
sScriptAuthor	= "INS Services"
sScriptBuild	= "1.002.0"		

'	COMMENT : 	- This script runs at logon to adjust Current User settings
'		  		- 

'============================================================================================================

'------------------------------------------------------------------------------------------------------------
'	Error handling 
'------------------------------------------------------------------------------------------------------------

on Error resume Next


EmersonUserLog "Script started"

'------------------------------------------------------------------------------------------------------------
'	Start of script
'   On startup this script will be added into general CU script, which contains all nessecary libray
'   functions and objects.
'   That is why is is importand to take the following into account :
'   	DO NOT REINITIALIZE COMMON OBJECTS AS WSHSHELL, FSO, WSCRIPT, etc. ! (as defined in INSLibrary.vbs and EmersonLibrary.vbs)
'   	DO NOT DELETE COMMON OBJECTS AS WSHSHELL, FSO, WSCRIPT, etc. ! (as defined in INSLibrary.vbs and EmersonLibrary.vbs)
'   	DO NOT REDEFINE COMMON SUBS AND FUNCTIONS!, etc. ! (as defined in INSLibrary.vbs and EmersonLibrary.vbs)
'------------------------------------------------------------------------------------------------------------

sDestination = sUserProfile & "\AppData\Local\Cisco\Cisco AnyConnect Secure Mobility Client\" 

If GetEmrsnAdComputerLocation=False Then
	EmersonUserLog "Looks like PC is not integrated in EMRSN AD"
	sRunOnceErr=513
Else
	Select Case sAdCorpDiv
		Case "PROCESS"
			Select Case sAdSub1
				Case "EMA"
					EmersonUserLog "No need for adjustments, Computer location is under EMEA region"
				Case "AMR"
					EmersonUserLog "Found PC under AMR, copying preferences.xml now..."
					MakeFolder sDestination
					fso.copyFile sCurrentFolder & "\preferences.xml", sDestination 
				Case "AP"
					EmersonUserLog "No need for adjustments, Computer location is under AP region"
			End Select
		Case Else
			EmersonUserLog "No need for adjustments, Computer location is NOT under PROCESS AD Structure"
	End Select	
End If

EmersonUserLog "Script ended"