Überblick: In diesem Artikel wird ein PowerShell-Skript (.ps1) verwendet, um den Wert für ein benutzerdefiniertes Feld von Atera abzurufen und es zur Installation von Sophos Antivirus auf einem Computer zu verwenden.
Anmerkungen:
- Sie müssten das Modul PSAtera in Powershell installieren, bevor Sie dieses Skript verwenden.
- Sie können das Skript an Ihre Anforderungen anpassen, indem Sie die Werte der Variablen in den ersten drei Zeilen des Skripts ändern.
Geschätzte Zeit zur Durchführung dieses Vorgangs: ~10 Minuten
Schritt 1. Kopieren Sie das folgende Skript
$AteraAPIKey = 'MY ATERA API KEY' $FieldName = 'Sophos Key' $SophosURI = 'https://SOME SHAREPOINT PUBLIC URL FOR/SophosSetup.exe' # Install and load the right version of Atera if (!(Get-Module -ListAvailable PSAtera)) { Install-Module -Name PSAtera -MinimumVersion 1.3.1 -Force } Import-Module -Name PSAtera -MinimumVersion 1.3.1 Set-AteraAPIKey -APIKey $AteraAPIKey # Get the agent information for the PC that's running the script $agent = Get-AteraAgent # Get the value from the Customer endpoint $customValue = Get-AteraCustomValue -ObjectType Customer -ObjectId $agent.CustomerID -FieldName $FieldName # Download Sophos Installer to temp path $SophosInstaller = Join-Path -Path $env:TEMP -ChildPath "SophosSetup.exe" Invoke-WebRequest -Uri $SophosURI -OutFile $SophosInstaller & $SophosInstaller --customertoken="$($customValue.ValueAsString)" --epiinstallerserver="api-cloudstation-us-east-2.prod.hydra.sophos.com" --products="all" --quiet # Get the status of the Sophos Install do { Get-Process -Name "*SophosSetup.exe*" Start-Sleep -Seconds 10 } while (Get-Process -Name "*SophosSetup.exe*" -ErrorAction SilentlyContinue) # After install is over, get the status of the Sophos Services Get-Service -Name "*Sophos*"
Schritt 2. Nehmen Sie alle erforderlichen Änderungen an den ersten 3 Variablen des Skripts vor.
Schritt 3. Führen Sie das Skript auf dem gewünschten Rechner aus.
Sie können das Skript in Atera hinzufügen und es über ein IT-Automatisierungsprofil ausführen.
HINWEIS: Das Skript wurde nicht auf Funktionalität geprüft. Bitte prüfen und testen Sie es zunächst in Ihrer Arbeitsumgebung.
Dave Long, vielen Dank für die Erstellung dieses Skripts und für Ihren Beitrag zur Atera-Community!