Class: VagrantWindows::Guest::Cap::ChangeHostName

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-windows/guest/cap/change_host_name.rb

Class Method Summary collapse

Class Method Details

.change_host_name(machine, name) ⇒ Object



5
6
7
8
9
10
# File 'lib/vagrant-windows/guest/cap/change_host_name.rb', line 5

def self.change_host_name(machine, name)
  #### on windows, renaming a computer seems to require a reboot
  machine.communicate.execute(
    "wmic computersystem where name=\"%COMPUTERNAME%\" call rename name=\"#{name}\"",
    :shell => :cmd)
end