<powershell>

$recipe_key = "chef/app-voicehost-1518138429.tar.gz"

Get-DnsClient | Set-DnsClientServerAddress -ServerAddress("<%= dns_servers.join(',')  %>")

Set-DnsClientGlobalSetting -SuffixSearchList @("curse.io")
Get-DnsClient | Set-DnsClient -ConnectionSpecificSuffix "curse.io"

echo "cookbook_path '/chef/cache/cookbooks'" | Out-File c:\chef\solo.rb -Encoding UTF8

mkdir /chef/cache
Set-ExecutionPolicy RemoteSigned -Force
Copy-S3Object -BucketName <%= deploy_bucket %> -Key $recipe_key -LocalFile c:\chef\cache\app-voicehost.tar.gz -Region us-east-1
cd /chef/cache
Start-Process C:\opscode\chef\bin\tar.exe "xvzf app-voicehost.tar.gz" -Wait
cd c:\

chef-solo -o app-voicehost::windows-firewall
chef-solo -o app-voicehost::finish-host

rm /chef/cache -recurse

echo <%= host_type || 1 %> > "C:\Program Files\CurseVoice\CurseVoiceMode.txt"

</powershell>
