Help/Skripty/PowerShell/InstallTrendMicro.ps1
2025-05-29 21:55:04 +02:00

51 lines
2.1 KiB
PowerShell
Executable File

$FOLDER = 'C:\TMP'
$MICRO = 'C:\Program Files (x86)\Trend Micro\Security Agent\PccNTMon.exe'
$FOLDERS = 'C:\Sony\Sonaps'
if (Test-Path -Path $FOLDER) {
"Adresar TMP existuje"
} else {
mkdir c:\TMP
}
Get-WmiObject -Class Win32_Product | where Name -like ("Kaspersky Endpoint Security*") |select IdentifyingNumber | ft -hide > C:\TMP\uuid_kasp.txt
(gc C:\TMP\uuid_kasp.txt ) | ? {$_.trim() -ne "" } | set-content C:\TMP\uuid_kasp.txt
$KES = Get-Content -Path C:\TMP\uuid_kasp.txt -TotalCount 1
if ($KES) {
start-Process -FilePath "$env:systemroot\system32\msiexec.exe" -ArgumentList '/x', $KES, 'KLLOGIN=KLAdmin', 'KLPASSWD=I.*nform1976', '/qn' -Wait
} else {
"Nenalezen : Kaspersky Endpoint Security pro systém Windows"
}
Get-WmiObject -Class Win32_Product | where Name -eq "Kaspersky Security Center Network Agent" |select IdentifyingNumber | ft -hide > C:\TMP\uuid_netagent.txt
(gc C:\TMP\uuid_netagent.txt ) | ? {$_.trim() -ne "" } | set-content C:\TMP\uuid_netagent.txt
$AGENT = Get-Content -Path C:\TMP\uuid_netagent.txt -TotalCount 1
if ($AGENT) {
cp \\pn03\Instalace\Kaspersky\Cleaner\cleaner.exe c:\TMP\
start-Process -FilePath "C:\TMP\cleaner.exe" -ArgumentList '/pc', $AGENT
} else {
"Nenalezen : Kaspersky Security Center Network Agent"
}
if (Test-Path -Path $MICRO ) {
"Antivir je jiz naistalovany"
} else {
if (Test-Path -Path $FOLDERS) {
Write-Output "Počítč má adresáč $FOLDERS"
$parms=@("/quiet", "/norestart" , "/lv", "C:\ApexOne.log";"/i";"\\pn03\Instalace\TrendMicro\Agents\AgentsApexCentral\Standalone\sonaps_agent_cloud_x64.msi")
(Start-Process -FilePath "$env:systemroot\system32\msiexec.exe" -ArgumentList $parms -Wait -Passthru).ExitCode
}else{
Write-Output "Počítč NEmá adresáč $FOLDERS"
$parms=@("/quiet", "/norestart" , "/lv", "C:\ApexOne.log";"/i";"\\pn03\Instalace\TrendMicro\Agents\AgentsApexCentral\Standalone\agent_cloud_x64.msi")
(Start-Process -FilePath "$env:systemroot\system32\msiexec.exe" -ArgumentList $parms -Wait -Passthru).ExitCode
}
}
Wait-Event -SourceIdentifier "ProcessStarted" -Timeout 30