Skip to content

Allow user to change the username, and include CodingWonders' curl request failure handling. #8

@0x6A7232

Description

@0x6A7232

User @CodingWonders added || /exit b 1 to the curl command which provides error handling in the event of download failure (say the user's cat tripped over the router). I've included that and also modification to allow the user to change the username. TEST THIS, as I HAVE NOT YET (I use Linux and would have to set up a VM to test which I may do in a bit). Here's the proposed changed version of bypass.cmd:

@echo off
curl -L -o C:\Windows\Panther\unattend.xml https://raw.githubusercontent.com/ChrisTitusTech/bypassnro/refs/heads/main/unattend.xml || /exit b 1

set "xmlfile=C:\Windows\Panther\unattend.xml"

powershell -Command "[xml]$xml = Get-Content '%xmlfile%'; $xml.SelectSingleNode('//LocalAccount/Name').InnerText" > temp.txt
set /p default=<temp.txt
del temp.txt

echo Default username is %default%
set /p newuser="Enter new username (press Enter to use default): "
if "%newuser%"=="" set newuser=%default%

powershell -Command "[xml]$xml = Get-Content '%xmlfile%'; $nameNode = $xml.SelectSingleNode('//LocalAccount/Name'); $nameNode.InnerText = '%newuser%'; $dispNode = $xml.SelectSingleNode('//LocalAccount/DisplayName'); if($dispNode){$dispNode.InnerText = '%newuser%'}; $xml.Save('%xmlfile%')"

%WINDIR%\System32\Sysprep\Sysprep.exe /oobe /unattend:C:\Windows\Panther\unattend.xml /reboot

bypass.cmd.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions