0

I have the need to rename a non-ad computer that was just created with Hyper-V via Powershell scripts to a meaningful name before I connect it to the domain.

I have the local username and password to that computer.

I have tried Rename-Computer as well as a Netdom command, but none of them are working as I cannot remotely connect to the computer due to username and passwords, and Netdom only works for AD computers that are part of the same domain.

I see two possible ways to do this, and I would like guidance for either one: 1. Use some sort of PowerShell Command, perhaps Rename-Computer would work, I would just need to supply some non-network credentials?
2. Execute a script in the Hyper-V Guest computer on the first start up, but then how can I tell what the name of the Hyper-V Host is calling the Guest from within the Guest?

Please assist!

Edit: I found that in the Guest, I see the name of the machine in the registry, and I can get this to work, but only if I can somehow launch of the machine.

billsecond
  • 199
  • 9

2 Answers2

0

I'm not sure how you plan on joining the machine to active directory, possibly with Powershell? You could do the computer rename old school and have Remote Desktop Connection enabled on the machine when it boots up. Then you can change the computer name when adding it to the domain via the GUI. Then if you don't want Remote Desktop enabled you can disable it with Powershell after you change the computer name or have your GPO disable RDP for you when the policies are applied o next boot.

TheGrandPackard
  • 206
  • 1
  • 10
0

Create an MDT task sequence that renames the computer (which could come from just about anywhere.) Launch a remote session and run the task sequence).

Jim B
  • 24,081
  • 4
  • 36
  • 60