Created
February 28, 2018 13:27
-
-
Save PSingletary/669d40f0b91ae3c79ec0903893a44be1 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
| $Credential = Get-Credential -Message User: username@DOMAIN or Domain\Username | |
| While ($true){ | |
| write-host "" | |
| $OldComputerName = Read-Host "What is the old computer name?" | |
| $NewComputerName = Read-Host "What is the new computer name?" | |
| $Restart = Read-Host "Restart the computer? Y for yes or N for no." | |
| if ($Restart -eq "Y"){ | |
| Rename-Computer -ComputerName $OldComputerName -NewName $NewComputerName -Restart -Force -DomainCredential $Credential -verbose | |
| } | |
| if ($Restart -ne "Y"){ | |
| Rename-Computer -ComputerName $OldComputerName -NewName $NewComputerName -Force -DomainCredential $Credential -verbose | |
| } | |
| }$Credential = Get-Credential -Message User: username@DOMAIN or Domain\Username | |
| While ($true){ | |
| write-host "" | |
| $OldComputerName = Read-Host "What is the old computer name?" | |
| $NewComputerName = Read-Host "What is the new computer name?" | |
| $Restart = Read-Host "Restart the computer? Y for yes or N for no." | |
| if ($Restart -eq "Y"){ | |
| Rename-Computer -ComputerName $OldComputerName -NewName $NewComputerName -Restart -Force -DomainCredential $Credential -verbose | |
| } | |
| if ($Restart -ne "Y"){ | |
| Rename-Computer -ComputerName $OldComputerName -NewName $NewComputerName -Force -DomainCredential $Credential -verbose | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment