by Patrik
From time to time we reinstall our terminalservers (50). After a re-installation the server register in the monitoring portal again. This is a problem because there are two servers in the monitoring with the same name! Is there a workarround (registry key or something else) available to do NOT reregister the agent and map the server to the "old" entry?
How does other customers handle this?
Regards
Patrik
How does other customers handle this?
Regards
Patrik
Like (1)
Reply
Replies (2)
Hi Patrik,
Can you please share the following details for us to analyze the case:
1. Specify the Operating System that's installed in this server?
2. Are these Servers cloud based? If yes, please share the service provider's name?
3. How do you reinstall your terminal server?
Regards,
Hisham Thorakkal
Like (0)
Reply
by Patrik
1 2012 R2 Remote Desktop Server
2 Not cloud based - on premise
3 We reinstall the server with a tasksequence (SCCM System Center Configuration Manager)
After windows installation we install the Site24x7 agent with a script
Thank you!
Patrik
2 Not cloud based - on premise
3 We reinstall the server with a tasksequence (SCCM System Center Configuration Manager)
After windows installation we install the Site24x7 agent with a script
- <#
Author:
10.03.2017
Description: Script installs monitoring agent Site 24x7
Notice: creates two autostart services - Site24x7 Agent Helper,Site24x7 Windows Agent
Change: disable tray icon added
#>
Param(
[parameter(mandatory=$True,Position=1)]
[string]$wrkDir
)
#logging
#region Logging
Function StartLog
{
$count = "${Product}_$Version".length
Add-content $scriptInstallLog -value "`n"
Add-content $scriptInstallLog -value $("*"*$($count +52))
Add-content $scriptInstallLog -value $("*$(" "*($count+50))*")
Add-content $scriptInstallLog -value "*$(" "*25)${Product}_$Version$(" "*25)*"
Add-content $scriptInstallLog -value "*$(" "*$($count+50))*"
Add-content $scriptInstallLog -value $("*"*$($count +52))
Add-content $scriptInstallLog -value "`n"
}
Function StopLog
{
$count = "${Product}_$Version".length
Add-content $scriptInstallLog -value "`n"
Add-content $scriptInstallLog -value $("*"*$($count +52))
Add-content $scriptInstallLog -value "`n"
if (($ExitCode -eq 0) -or ($ExitCode -eq 3010)) {Add-content $scriptInstallLog -value "$($MyInvocation.ScriptName) successfully completed with returncode $ExitCode"}
else {Add-content $scriptInstallLog -value "$($MyInvocation.ScriptName) failed with returncode $ExitCode"}
}
Function WriteLog ($err)
{
$DateTime=Get-Date -Format "dd-MM-yyyy HH:mm:ss"
Add-content $scriptInstallLog -value ($DateTime + " I - "+ $err)
}
function WriteEmptyline
{
Add-content $scriptInstallLog -value `n
}
Function WriteLogE ($err)
{
$DateTime=Get-Date -Format "dd-MM-yyyy HH:mm:ss"
Add-content $scriptInstallLog -value ($DateTime + " E - " + $err)
}
Function WriteLogW ($err)
{
$DateTime=Get-Date -Format "dd-MM-yyyy HH:mm:ss"
Add-content $scriptInstallLog -value ($DateTime + " W - " + $err)
}
#endregion
#other functions
Function G_RegSetItemProperty
{
param(
[Parameter(Mandatory=$True)]
[string]$RegistryPath,
[Parameter(Mandatory=$True)]
[string]$Name,
[Parameter(Mandatory=$True)]
[string]$Value
)
if (!(Test-Path $RegistryPath ))
{
mkdir $RegistryPath
}
try
{
Set-ItemProperty $RegistryPath -Name $Name -Value $Value -ErrorAction Stop
WriteLog "Name $Name Value $Value successfully added to registry $RegistryPath"
return 0
}
catch
{
WriteLogE "Add Name $Name Value $Value to registry $RegistryPath failed with error $_"
return 5
}
}
#region MSI install/uninstall
Function G_InstallMSI
{
param(
[Parameter(Mandatory=$true)]
[string]$MSI,
[Parameter(Mandatory=$true)]
[array]$Argument
)
$MSIFile = Join-Path "$wrkDir" "MSI\$MSI"
$MSILogFile = Join-Path $MSILogs "Install_$($MSI.replace(".msi",".log"))"
$Arguments = @("/i","`"$MSIFile`"")
$Arguments += $Argument
$Arguments += " /L*V " + $MSILogFile
WriteLog "starting installation of $MSI"
$installation = Start-Process msiexec.exe -ArgumentList $Arguments -Wait -PassThru
if (($installation.ExitCode -eq 0) -or ($installation.ExitCode -eq 3010) )
{
WriteLog "installation of MSI $MSI ended successfully"
}
else
{
WriteLogE "during installation of MSI $MSI error $($installation.ExitCode) occured"
}
WriteEmptyline
return $installation.ExitCode
}
#endregion
######################################################################
#Program
######################################################################
#Variables
$Product = "Site24x7_WindowsAgent"
$Version = "18.1.5_01"
$logDir = "C:\Logs"
$scriptInstallLog = Join-Path $logDir "Install-${Product}_$Version.log"
$MSILogs = Join-Path $logDir "${Product}_$Version"
$InstallDir = "${env:ProgramFiles(x86)}\Site24x7"
$ExitCode = 0
#create log dir
if (!(Test-Path $logDir)) {mkdir $logDir}
if (!(Test-Path $MSILogs)) {mkdir $MSILogs}
StartLog
#start installation
##########
# MSI #
##########
$ExitCode += G_InstallMSI "Site24x7WindowsAgent.msi" -Argument "EDITA1=******* ENABLEPROXY=yes ProxyServerName=****** ProxyUserName=******** ProxyPassword=******* /qn"
#disable tray icon
$TrayIconProcess = Start-Process -FilePath "$InstallDir\WinAgent\monitoring\bin\Site24x7WindowsAgentTrayIcon.exe" -ArgumentList "-s" -PassThru -NoNewWindow
$TrayIconProcess.Kill()
$ExitCode += G_RegSetItemProperty -RegistryPath "HKLM:\SOFTWARE\Wow6432Node\ManageEngine\Site24x7WindowsAgent" -Name EnableAgentTrayIcon -Value NO
######################################################################
StopLog
exit $ExitCode
Thank you!
Patrik
Like (0)
Reply