Quantcast
Channel: VMware Communities : Discussion List - ESXi
Viewing all articles
Browse latest Browse all 8132

How to replace IP 10.*.*.* in /etc/opt/vmware/vpxa/vpxa.cfg

$
0
0

Hey everyone, I need to REIP a LOT of esx hosts, and am really close, but either through Powershell / Powercli / plink I can't seem to figure out hot to replace the vCenter IP address in  /etc/opt/vmware/vpxa/vpxa.cfg on all of our hosts. the closest I can get is to output the entire file-

 

$vpxacfg = echo y | plink.exe -pw $password root@$vmhost cat /etc/opt/vmware/vpxa/vpxa.cfg

$vpxacfg | Out-File H:\Reports\VMWare\vpxa\$vmhost-vpxa.cfg

 

And from there I can replace the string just fine with powershell-

 

 

#Replace vpxacfg <serverIp>10.1.226.100</serverIp> -> <serverIp>10.228.42.100</serverIp>

$line = $vpxacfg | ? {$_ -like '*<serverIp>10.1.226.100</serverIp>*'}

$oldstring=$line

$newstring = $line -replace "<serverIp>10.1.226.100</serverIp>","<serverIp>10.228.42.100</serverIp>"

$newvpxacfg = $vpxacfg.Replace($oldstring,$newString)

 

But I don't know how to upload the file with plink to our ESXi hosts once its been modified. In plink I can grep the file;

 

echo y | plink.exe -pw $password root@$vmhost grep -e 10.1.226.100 /etc/opt/vmware/vpxa/vpxa.cfg

 

But I cant figure out the syntax to replace, and commands like sed are not available. Any thoughts?

 

Thanks,

Jon


Viewing all articles
Browse latest Browse all 8132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>