#!ps #timeout=9000000 #maxlength=9000000 # Tragen Sie Ihren FQDN Ihres neuen Servers ein, z.B.: 'automate.myfqdn.com' (ohne https://) $FQDN = 'automate.myfqdn.com' # Öffnen Sie die "config"-Tabelle in der Mysql-Datenbank auf Ihrem neuen Server (z.B. mit https://www.heidisql.com/). # Tragen Sie das Server-Passwort aus dem Feld SystemPassword ein. $SystemPass = 'SystemPass' # Tragen Sie hier die ID der Location ein, der der Agent zugeordnet werden soll. # Die Location-ID finden Sie in der Mysql-Datenbank Ihres neuen Servers in der Tabelle locations # sowie in der Titelzeile des Location-Fensters im Control Center. $LocationID = '2' # Tragen Sie hier einen Download-Pfad ein, in dem die Installer abgelegt werden sollen. $SoftwarePath = 'C:\Windows\Temp' # Die folgende Variable konvertiert den FQDN in eine URL für Downloads. Wenn HTTPS geblockt ist, bitte in HTTP ändern. # Bitte beachten: HTTPS-Downloads funktionieren nicht bei älteren Computern (XP /2003)! $AutomateURL = "HTTPS://$($FQDN)" Write-Host "Ihr FQDN ist: $($AutomateURL)" -ForegroundColor Yellow Write-Host "Ihr System Password ist: $($SystemPass)" -ForegroundColor Yellow # Aktuellen Agent entfernen if (Test-Path c:\windows\ltsvc) { $DownloadPath = "$($AutomateURL)/labtech/service/LabUninstall.exe" $Filename = [System.IO.Path]::GetFileName($DownloadPath) $SoftwareFullPath = "$($SoftwarePath)\$Filename" $wc = New-Object System.Net.WebClient if (!(Test-Path $SoftwarePath)) {md $SoftwarePath} if ((Test-Path $SoftwareFullPath)) {remove-item $SoftwareFullPath} $wc.DownloadFile($DownloadPath, $SoftwareFullPath) Write-Host "Aktuellen Agent entfernen..." sc.exe stop "LTService" sc.exe stop "LTSvcMon" Start-Sleep 10 sc.exe query "LTService" sc.exe query "LTSvcMon" taskkill /im ltsvcmon.exe /f taskkill /im lttray.exe /f taskkill /im ltsvc.exe /f Invoke-Expression "$($SoftwareFullPath) /quiet /norestart" Write-Host "60 Sekunden warten..." -ForegroundColor Gray Start-Sleep 60 if (Test-Path c:\windows\ltsvc\lterrors.txt) { Write-Host " weiter warten..." -ForegroundColor Gray Start-Sleep 90} if (Test-Path c:\windows\ltsvc\lterrors.txt) { Write-Host "Fehler: C:\Windows\LTSVC existiert noch!" -ForegroundColor Red} else { Write-Host "Automate-Agent erfolgreich entfernt!" -ForegroundColor Green }} # Neuen Agent installieren $DownloadPath2 = "$($AutomateURL)/labtech/service/LabTechRemoteAgent.msi" $Filename2 = [System.IO.Path]::GetFileName($DownloadPath2) $SoftwareFullPath2 = "$($SoftwarePath)\$Filename2" $wc = New-Object System.Net.WebClient if (!(Test-Path $SoftwarePath)) {md $SoftwarePath} if ((test-path $SoftwareFullPath2)) {remove-item $SoftwareFullPath2} $wc.DownloadFile($DownloadPath2, $SoftwareFullPath2) Write-Host "Automate-Agent von $($AutomateURL) wird installiert..." -ForegroundColor Yellow msiexec.exe /i $($SoftwareFullPath2) /quiet /norestart SERVERADDRESS=$($AutomateURL) SERVERPASS=$($SystemPass) LOCATION=$($LocationID) Write-Host "3 Minuten warten, bis Installation abgeschlossen ist..." -ForegroundColor Gray Start-Sleep -s 180 # sc.exe start ltsvcmon # sc.exe start ltservice if (Test-Path c:\windows\ltsvc\lterrors.txt) { C:\WINDOWS\LTSVC\LTTray.exe $AutomateSrvAddrReg = (Get-ItemProperty "HKLM:\SOFTWARE\LabTech\Service").'Server Address' $AutomateCompIDReg = (Get-ItemProperty "HKLM:\SOFTWARE\LabTech\Service").ID Write-Host "Der Automate-Agent hat sich erfolgreich gemeldet bei:" -ForegroundColor Green Write-Host "$($AutomateSrvAddrReg)" -ForegroundColor Green Write-Host "Computer ID: $($AutomateCompIDReg)" -ForegroundColor Green }
$inputLocation = Read-Host "LocationID" iex (new-object Net.WebClient).DownloadString('https://bit.ly/LTPoSh') Install-LTService -Server 'https://automate.server.com' -LocationID $inputLocation -ServerPassword 'ServerPassword' -Force
Trouble logging in? Simply enter your email address OR username in order to reset your password.
For faster and more reliable delivery, add support@ebertlang.com to your trusted senders list in your email software.