Commit 3486deb16e1dbf433bfa477db4797c701ff885cf

Authored by Warley Eric Rodrigues Rocha
1 parent eecc78a2
Exists in master

Script adaptado para GPO

Showing 1 changed file with 138 additions and 0 deletions   Show diff stats
spark.ps1 0 → 100644
... ... @@ -0,0 +1,138 @@
  1 +New-Item $env:TEMP\spark.properties -type file -force -value "#Spark Settings
  2 +#Fri Jul 28 21:20:52 BRT 2017
  3 +username=SeuSiape
  4 +ccAdvancedConfig=true
  5 +hostAndPort=false
  6 +proxyEnabled=false
  7 +windowTakesFocus=false
  8 +useVersionAsResource=false
  9 +compressionOn=false
  10 +notifyOnOffline=false
  11 +disableAsteriskToasterPopup=false
  12 +checkForBeta=false
  13 +trustStorePassword=
  14 +videoDevice=imgstreaming\:0
  15 +audioDevice=audiosilence\:
  16 +SelectedCodecs=ALAW/rtp^ULAW/rtp^gsm/rtp^g723/rtp^
  17 +xmppHost=
  18 +isMucRandomColors=true
  19 +isMucHighNameOn=false
  20 +isMucHighTextOn=false
  21 +AvailableCodecs=
  22 +resource=Spark
  23 +SystemTrayNotificationEnabled=false
  24 +showOfflineUsers=false
  25 +loginAnonymously=false
  26 +server=chat.cefetes.br
  27 +useHostnameAsResource=false
  28 +showHistory=true
  29 +DisableHostnameVerification=true
  30 +pkiEnabled=false
  31 +debuggerEnabled=false
  32 +notifyOnOnline=false
  33 +showPrevHistory=true
  34 +DisplayTime=1000
  35 +ccInvisibleLogin=true
  36 +ssoEnabled=false
  37 +toasterPopup=false
  38 +pkiStore=JKS
  39 +xmppPort=5222
  40 +proxyPassword=
  41 +isMucHighToastOn=false
  42 +buzzEnabled=true
  43 +stunFallbackHost=
  44 +HISTORY_SORT_DATEASC=true
  45 +loginAsInvisibleEnabled=false
  46 +isShowingRoleIcons=false
  47 +timeFormat=HH\:mm
  48 +protocol=SOCKS
  49 +lastUpdateCheck=1501287514968
  50 +showTypingNotification=false
  51 +proxyUsername=
  52 +showEmptyGroups=false
  53 +timeout=10
  54 +ccAnonymousLogin=true
  55 +AcceptAllCertificates=true
  56 +chatNotificationOn=true
  57 +offlineGroupVisible=true
  58 +password
  59 +jksPath=
  60 +autoAcceptMucInvite=false
  61 +audioSystem=wasapi
  62 +timeDisplayed=true
  63 +ccAccountsReg=true
  64 +ccHostNameChange=true
  65 +useAdHocRoom=true
  66 +tabsOnTop=true
  67 +passwordSaved=true
  68 +ccPswdAutologin=true
  69 +defaultChatLengthTimeout=15
  70 +isShowJoinLeaveMessagesOn=true
  71 +autoLoginEnabled=true
  72 +stunFallbackPort=3478
  73 +sslEnabled=false
  74 +trustStorePath=
  75 +playbackDevice=wasapi\:{3.0.0.00000002}.{6C26BA7D-F0B2-4225-B422-8168C5261E45}
  76 +ssoMethod=file
  77 +saslGssapiSmack3compat=false
  78 +" | out-null
  79 +######
  80 +$date = Get-Date
  81 +$App = "Spark"
  82 +$Version = "2.8.3"
  83 +$AppExe = "C:\Program Files (x86)\Spark\Spark.exe" #executavel do aplicativo após instalação
  84 +$AppDate = "2017-01-29" #data do aplicativo, para verificar a atualização
  85 +$SourceFile = "\\gr-fs\install\Padrao\Aplicativos\spark_2_8_3_online.exe" #local do installer na rede
  86 +$spark_properties = "$env:TEMP\spark.properties"
  87 +$FileExe = "$env:TEMP\spark_2_8_3.exe" #local do installer na maquina
  88 +$Parameters = "-q" #parametros de instalação
  89 +$Process = "Installer" #nome do processo do installer
  90 +$LogFile = "$env:TEMP_$env:computername.txt" #arquivo de log de instalação e atualização
  91 +# Função para a instalação do aplicativo
  92 +#
  93 +function instalar ($Arg1,$Arg2)
  94 + {
  95 + if (!(test-path $FileExe)) #Arquivo de instalação local encontrado?
  96 + {
  97 + if (test-path "$env:TEMP\spark*.exe") #remove arquivos de instalação antigos se existirem
  98 + {Get-ChildItem "$env:TEMP\spark_*.exe"|ForEach-Object { Remove-Item $_ }
  99 + }
  100 + Copy-Item -Path $SourceFile -Destination $FileExe | out-null #copia o arquivo de instalação novo
  101 + start-sleep 10
  102 + }
  103 + $proc = Get-Process
  104 + if ($proc.name -contains "Spark") {Stop-Process -Name Spark -Force -Confirm}
  105 + & $Arg1 + $Arg2
  106 + start-sleep 20 #aguarda o processo de instalação iniciar
  107 + Do { #aguarda a finalização do processo
  108 + start-sleep 10
  109 + $proc = Get-Process
  110 + } While ($proc.name -contains $Process)
  111 +
  112 + $date = Get-Date
  113 + Add-Content -Path $LogFile -Value ("O $App versão $Version foi instalado em $date")
  114 + # Substituição do arquivo de configuração para todos os usuários da maquina
  115 + $Users = Get-ChildItem -Directory -Path C:\Users
  116 + ForEach ($User in $Users){
  117 + $dir = "C:\Users\" + $User.name + "\AppData\Roaming\Spark"
  118 + if (!(test-path $dir)) {mkdir $dir}
  119 + $file = $dir + "\spark.properties"
  120 + Copy-Item -Path $spark_properties -Destination $file | out-null
  121 + }
  122 + }
  123 +# Inicio da rotina de verificação da instalação do aplicativo
  124 +#
  125 +if (test-path $AppExe) #Aplicativo Instalado?
  126 + {
  127 + if ((Get-ItemPropertyValue -Name lastwritetime -Path $AppExe) -gt (get-date $AppDate))
  128 + { instalar $FileExe $Parameters}
  129 + }
  130 + else
  131 + {
  132 + instalar $FileExe $Parameters
  133 + }
  134 +# Substituição do arquivo de configuração padrão para os novos usuários da maquina
  135 +$dir = "C:\Users\Default\AppData\Roaming\Spark"
  136 +if (!(test-path $dir)) {mkdir $dir}
  137 +$file = $dir + "\spark.properties"
  138 +Copy-Item -Path $spark_properties -Destination $file | out-null
0 139 \ No newline at end of file
... ...