Skip to content

Instantly share code, notes, and snippets.

@fluggelgleckheimlen
Created September 20, 2024 10:09
Show Gist options
  • Save fluggelgleckheimlen/13db80b9df8f060c4b6c67656614c9e0 to your computer and use it in GitHub Desktop.
Save fluggelgleckheimlen/13db80b9df8f060c4b6c67656614c9e0 to your computer and use it in GitHub Desktop.
Проверяет обновления VK Teams, при загрузке должны быть проверки, но мне лень их писать и пока работает без сбоев
$VK = Invoke-WebRequest -Method Head -Uri https://vkteams-www.hb.bizmrg.com/win/x32/vkteamssetup.exe
$lastmod = $VK.Headers.'Last-Modified'
$lastdate = Get-Content -Path .\lastmodified.txt
$chatid = "@mychatid"
if ($lastmod -like $lastdate) {
$oldver = (Get-Item ".\vkteamssetup.exe").VersionInfo.FileVersion
$text = "Нет новых версий после $oldver."
echo $text
#.\Telegram.ps1 -chat_id $chatid -text $text -markdown -nopreview
} else {
Invoke-WebRequest -Method Get -Uri https://vkteams-www.hb.bizmrg.com/win/x32/vkteamssetup.exe -OutFile ".\vkteamssetup.exe"
$newver = (Get-Item ".\vkteamssetup.exe").VersionInfo.FileVersion
$text = "VK Teams обновился до версии $newver."
.\Telegram.ps1 -chat_id $chatid -text $text -markdown -nopreview
If (!$error) {$lastmod > lastmodified.txt}
}
@fluggelgleckheimlen
Copy link
Author

Установка через BigFix (у каждой версии есть фиксированный урл):

prefetch vkteamssetup.exe sha1:1427af05f72eca22501a93081ceb1c3a5aad2bb5 size:179791744 https://vkteams-www.hb.bizmrg.com/win/x32/24.5.3.45991/vkteamssetup.exe sha256:4aff17ef23551760a3fb9c61c4ca6bcaf2436f1e037a0e8e60a7a5bc54eab9db
wait __Download\vkteamssetup.exe -appx -allusers

Relevance:

device type != "Server"
exists key whose (value "DisplayName" of it as string starts with "VK Teams" AND value "DisplayVersion" of it as string as version < "24.5.3.45991" AND value "InstallLocation" of it as string is "C:\Program Files (x86)\VK Teams\") of keys "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry
not exists key whose (value "DisplayName" of it as string starts with "VK Teams" AND value "InstallLocation" of it as string starts with "C:\Users\") of keys "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry
not exists file "vkteams.exe" whose (version of it >= "24.5.3.45991") of folders ((value of variable "ProgramFiles" of environment) & "\VK Teams\")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment