Created
June 2, 2023 19:44
-
-
Save manu-romero-411/b51ac30565351c431e76d351436ebdc7 to your computer and use it in GitHub Desktop.
Random hostname generator for Windows
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
@echo off | |
net session >nul 2>&1 | |
if %errorLevel% == 0 ( | |
goto program | |
) else ( | |
echo You must run this script as Administrator. | |
pause | |
exit 1 | |
) | |
:program | |
wmic computersystem where name="%COMPUTERNAME%" call rename name="%RANDOM%" | |
echo Done. Reboot to apply. | |
pause | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment