Created
November 4, 2015 06:11
-
-
Save ZJPat/6a19aeb762b45bc5ce1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Set-ComputerName { | |
| param( [switch]$help, | |
| [string]$CurrentPCName=$(read-host "Please specify the current name of the computer"), | |
| [string]$computerName=$(read-host "Please specify the new name of the computer")) | |
| $usage = "set-ComputerName -CurrentPCname CurrentName -computername AnewName" | |
| if ($help) {Write-Host $usage;break} | |
| $computer = Get-WmiObject Win32_ComputerSystem -CurrentPCname CurrentName -computername $currentPCName | |
| $computer.Rename($computerName) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment