VMware, Inc. 129
Chapter 5 Installing and Using VMware Tools
Passing a String from the Host to the Guest at Startup
Topassastringfromthehosttotheguestatstartup,youpassthestringfromyour
virtualmachine’sconfigurationfileinthehosttotheguestoperatingsystemwhenyou
poweronthevirtualmachine.
YoucanpassitemsliketheWindowssystemID(SID),amachinename,oran
IP
addr
ess.Insidetheguestoperatingsystemstartupscript,youcanhavetheservice
retrievethisstring.Thestringcanthenbeusedinanotherscripttosetyourvirtual
machine’ssystemID,machinename,orIPaddress.
Usethisstrategy,forexample,tomakecopiesofthesameconfigurationfile,adda
diffe
rentstringtoeach(eitherintheconfigurationfileitselforatthecommandline),
andusethesevariationsofthesameconfigurationfiletolaunchthesamevirtualdisk
innonpersistentmodemultipletimesinatrainingortestingenvironment.
Passingastringisalsousefulwhenyouwanttode
ployvirtualmachinesonanetwork
usingacommonconfigurationfilewhileprovidingeachmachinewithitsownunique
identity.
Youcanpassstringstoavirtualmachine’sguestoperatingsysteminoneoftwoways:
placingthestringinthevirtualmachine’sconfigurationfileorpassingthestringtothe
gues
tfromthecommandline.
Usethisfeatureonlyifyouhaveagoodunderstandingofascriptinglanguage(for
example,PerlorNetShell)andknowhowtomodifysystemstartupscripts.
String in a Configuration File
Placeastringinthevirtualmachine’sconfigurationfile(.vmxfile)bysettingthestring
tothemachine.idparameter.Forexample,youcansetthisstring:
machine.id = "Hello World."
Followingisanexampleofportionsoftwoconfigurationfilesthatpointtothesame
virtualdisk.Eachconfigurationfilecontainsitsownuniquestringsetforthe
machine.idparameter.
config_file_1.vmxcontains:
ide0:0.present = TRUE
ide0:0.fileName = "my_common_virtual_hard_drive.vmdk"
machine.id = "the_string_for_my_first_vm"
config_file_2.vmxcontains:
ide0:0.present = TRUE
ide0:0.fileName = "my_common_virtual_hard_drive.vmdk"
machine.id = "the_string_for_my_second_vm"
Comentarios a estos manuales