Skip to content

Instantly share code, notes, and snippets.

@manu-romero-411
Created June 2, 2023 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manu-romero-411/b51ac30565351c431e76d351436ebdc7 to your computer and use it in GitHub Desktop.
Save manu-romero-411/b51ac30565351c431e76d351436ebdc7 to your computer and use it in GitHub Desktop.
Random hostname generator for Windows
@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