fixed VM initialization script

This commit is contained in:
Stan Lagun 2013-03-27 02:07:53 +04:00
parent 74958e1052
commit 8ffd75cc1e
1 changed files with 12 additions and 15 deletions

View File

@ -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 ) {