Skip to content

Instantly share code, notes, and snippets.

@babakc
Created August 27, 2016 12:36
Show Gist options
  • Save babakc/450f48a821f648b30dd3a727d1fb0e16 to your computer and use it in GitHub Desktop.
Save babakc/450f48a821f648b30dd3a727d1fb0e16 to your computer and use it in GitHub Desktop.
$EC2SettingsFile="C:\Program Files\Amazon\Ec2ConfigService\Settings\Config.xml"
$xml = [xml](get-content $EC2SettingsFile)
$xmlElement = $xml.get_DocumentElement()
$xmlElementToModify = $xmlElement.Plugins
foreach ($element in $xmlElementToModify.Plugin)
{
if ($element.name -eq "AWS.EC2.Windows.CloudWatch.PlugIn")
{
$element.State="Enabled"
}
}
$xml.Save($EC2SettingsFile)
stop-process -name EC2Config -force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment