Skip to content

Instantly share code, notes, and snippets.

@schisamo
Created October 28, 2011 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schisamo/761eae49a1145aa3133e to your computer and use it in GitHub Desktop.
Save schisamo/761eae49a1145aa3133e to your computer and use it in GitHub Desktop.
include_recipe 'powershell'
powershell "rename hostname" do
code <<-EOH
$computer_name = Get-Content env:computername
$new_name = 'test-hostname'
$sysInfo = Get-WmiObject -Class Win32_ComputerSystem
$sysInfo.Rename($new_name)
EOH
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment