Ein Beispiel für ein PowerShell-Skript zur Bereitstellung des Agenteninstallationsprogramms mithilfe der Active Directory-Gruppenrichtlinienverwaltungskonsole.
Ändern Sie die Variablen im Code, um sie bei Bedarf an Ihre Umgebung anzupassen, wie
zum Beispiel
$logpathlocal, $uncPath und $localPath.Das Skript erfordert die Verwendung von System zur Ausführung, um Sicherheitsbedenken
bei der Verwendung eines hoch privilegierten Kontos zu vermeiden.
$logpathlocal="C:\temp\V1ES\Logs" #Specify a path users have enough permission to write to.
Start-Transcript -Path $logpathlocal -Append
$service = Get-Service -Name tmlisten,ntrtscan,amsp,ds_agent -ErrorAction SilentlyContinue
if ($service -eq $null) {
$uncPath = "\\TrendMicro_Demo_VS\V1ES_client\V1ES" #Specify the UNC location of the unzipped agent installation files
$localPath = "C:\temp\" #The location to copy the installation files to on the target endpoint
$installerFileName = "EndpointBasecamp.exe"
Copy-Item -Path $uncPath -Destination $localPath -Recurse -Force
while ((Get-ChildItem $localPath).Count -lt (Get-ChildItem $uncPath).Count) {
Start-Sleep -Seconds 1
}
Write-host "File copy completed, start to install progress"
$localInstallerPath = Join-Path $localPath $installerFileName
Start-Process -Wait -FilePath $localInstallerPath -ArgumentList '/s /v/qn' -PassThru
} else {
Write-host "The services already existed, skip the installation."
}
Stop-Transcript
