Created
May 1, 2021 17:40
-
-
Save numbnet/f11da93978d2f0a30450cf43fcb2e27a to your computer and use it in GitHub Desktop.
Rename Computer
This file contains 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
$NEWCOMPUTERNAME = MyPC; | |
echo "This PC Name - $env:COMPUTERNAME"; | |
if ($env:ComputerName -in $NEWCOMPUTERNAME) { | |
echo " | |
This is Computer - $env:COMPUTERNAME | |
======================================== | |
"; | |
exit | |
} else { | |
echo "Rename this Computer?"; pause; Rename-Computer -NewName $NEWCOMPUTERNAME -Force; | |
echo "Restart Computer? "; pause; Restart-Computer -Force -Confirm; | |
} | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment