Last active
April 11, 2016 20:44
-
-
Save pavelch/f3b3a551abdc50b50904c1f1b219f419 to your computer and use it in GitHub Desktop.
PowerShell update IP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$path = 'C:\Verne\Data\Config\VerneConfig.omcfg' | |
$ip = '' | |
$out = Get-CFNStackResourceSummary -StackName "AWSCloudFormer" | Out-String | |
$sums = [regex]::split($out, "LastUpdatedTimestamp.*\r\n") | |
foreach ($sum in $sums) { | |
if ($sum -Match "LogicalResourceId\s*:\s*InvestigatorFarm") { | |
$ip = $sum | sls '(?<=PhysicalResourceId\s*:\s*)(.*)(?=\r\n)' | select -expa matches | select -expa value | % { $_.trim() } | |
} | |
} | |
$xml = [xml](Get-Content $path) | |
$node = $xml.ConfigSectionBase.VerneConfigHostname | |
Write-Host $xml.ConfigSectionBase.VerneConfigHostname | |
$xml.ConfigSectionBase.VerneConfigHostname = $ip | |
Write-Host $xml.ConfigSectionBase.VerneConfigHostname | |
$xml.Save($path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment