Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 219257

Re: Script issue with changing hostname

$
0
0

First when you are declaring a new variable be sure to use var unless you intention is to make it globally accessible.  I'm guessing this line:

 

Build=vCACVmProperties.get('VirtualMachine.BuildType');


should be:


var Build=vCACVmProperties.get('VirtualMachine.BuildType');


I'm not positive how all the scoping shakes out in vRO but if you haven't read up on variable scoping in javascript I'd take a look here JavaScript Scope.


and I think this is the line you want for setting cmd:


var cmd='sed -i -e \"s/CURRENTHOSTNAME/' + newHostName + '/g\" /etc/hosts';

 

You need to escape the " and also forgot a plust sign between the strings and the variable.


Viewing all articles
Browse latest Browse all 219257

Trending Articles



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