# encoding: ascii
# api: powershell
# title: Set-Computername
# description: A function to rename a computer
# version: 0.1
# type: function
# author: Andy Schneider
# license: CC0
# function: Set-ComputerName
# x-poshcode-id: 1997
# x-archived: 2010-07-21T21:16:26
#
# Andy Schneider
# get-powershell.com
#
function Set-ComputerName {
param( [switch]$help,
[string]$computerName=$(read-host "Please specify the new name of the computer"))
$usage = "set-ComputerName -computername AnewName"
if ($help) {Write-Host $usage;break}
$computer = Get-WmiObject Win32_ComputerSystem
$computer.Rename($computerName)
}