Better heuristic for ip addr

This commit is contained in:
Nikolaos Kakouros 2017-08-09 17:56:58 +02:00
parent 262f34dd19
commit 566b6f0c87
1 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,15 @@
$ip=get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.Ipaddress.length -gt 1}
$ipaddr = $ip[0].ipaddress[0]
$ip=get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.IPAddress -gt 1}
if ($ip.count -gt 0) {
$ip = $ip[0]
}
if ($ip.IPAddress.count -gt 0) {
$ipaddr = $ip.IPAddress[0]
} else {
$ipaddr = $ip[0].ipaddress[0]
}
Write-Host "Updating Wordpress IP to $ipaddr"
$cmd = 'C:\wamp\bin\mysql\mysql5.5.20\bin\mysql.exe -u root --password="" -e "use wordpress; update wp_options set option_value=''http://'+$ipaddr+':8585/wordpress'' where option_name=''siteurl'';"'