diff --git a/conductor/data/init.ps1 b/conductor/data/init.ps1 index 12c24538..0e6cb212 100644 --- a/conductor/data/init.ps1 +++ b/conductor/data/init.ps1 @@ -9,22 +9,19 @@ $RestartRequired = $false Import-Module CoreFunctions -if ( $WindowsAgentConfigBase64 -ne '%WINDOWS_AGENT_CONFIG_BASE64%' ) { - Write-Log "Updating Keero Windows Agent." - Stop-Service "Keero Agent" - Backup-File $WindowsAgentConfigFile - Remove-Item $WindowsAgentConfigFile -Force - ConvertFrom-Base64String -Base64String $WindowsAgentConfigBase64 -Path $WindowsAgentConfigFile - Exec sc.exe 'config','"Keero Agent"','start=','delayed-auto' - Write-Log "Service has been updated." -} +Write-Log "Updating Keero Windows Agent." +Stop-Service "Keero Agent" +Backup-File $WindowsAgentConfigFile +Remove-Item $WindowsAgentConfigFile -Force +ConvertFrom-Base64String -Base64String $WindowsAgentConfigBase64 -Path $WindowsAgentConfigFile +Exec sc.exe 'config','"Keero Agent"','start=','delayed-auto' +Write-Log "Service has been updated." + +Write-Log "Renaming computer ..." +Rename-Computer -NewName $NewComputerName | Out-Null +Write-Log "New name assigned, restart required." +$RestartRequired = $true -if ( $NewComputerName -ne '%INTERNAL_HOSTNAME%' ) { - Write-Log "Renaming computer ..." - Rename-Computer -NewName $NewComputerName | Out-Null - Write-Log "New name assigned, restart required." - $RestartRequired = $true -} Write-Log 'All done!' if ( $RestartRequired ) {