From 8ffd75cc1eab26503b4622b9087c3c51cf91a5a5 Mon Sep 17 00:00:00 2001 From: Stan Lagun Date: Wed, 27 Mar 2013 02:07:53 +0400 Subject: [PATCH] fixed VM initialization script --- conductor/data/init.ps1 | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/conductor/data/init.ps1 b/conductor/data/init.ps1 index 12c2453..0e6cb21 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 ) {