Skip to main content
Question

Automate in-guest script execution on the guest VMs during recovery (NGT)

  • 24 May 2023
  • 1 reply
  • 93 views

Hi can someone know the script to change the computer name during recovery plan. This is our script, everything is working except the script to change computer name. Thank you.

 

netsh interface ip set address name="Ethernet 4" source=static ^ address=x.x.x. mask=255.255.255.0 gate=x.x.x.x
netsh interface ip set dnsservers "Ethernet 4" static x.x.x.x
timeout /t 10 /nobreak


WMIC computersystem where name="computername" call rename name="newcomputername"

shutdown.exe -r -t 00

 

 

With powershell (run in administrator mode): Rename-Computer -NewName <NewName>

 

Or, if you want to do if from the cmd line: PowerShell.exe -ExecutionPolicy RemoteSigned -Command “Rename-Computer -NewName <NewName>”