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