Is it possible to change the hostname in Windows 2003 from the command line with out-of-the-box tools?
相关问题
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
- I want to trace logs using a Macro multi parameter
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Bundling the Windows Mono runtime with an applicat
- Windows 8.1 How to fix this obsolete code?
- Compile and build with single command line Java (L
- CosmosDB emulator can't start since port is al
- How to print to stdout from Python script with .py
cmd (command):
powershell (windows 2008/2012):
after that, you need to reboot your computer.
Here's another way of doing it with a WHS script:
Source
The netdom.exe command line program can be used. This is available from the Windows XP Support Tools or Server 2003 Support Tools (both on the installation CD).
Usage guidelines here
Use below command to change computer hostname remotely , Require system reboot after change..
psexec.exe -h -e \\\IPADDRESS -u USERNAME -p PASSWORD netdom renamecomputer CurrentComputerName /newname:NewComputerName /force
If you are looking to do this from Windows 10 IoT, then there is a built in command you can use:
setcomputername [newname]
Unfortunately, this command does not exist in the full build of Windows 10.
Why be easy when it can be complicated? Why use third-party applications like netdom.exe when correct interogations is the way? Try 2 interogations:
wmic computersystem where caption='%computername%' get caption, UserName, Domain /format:value
wmic computersystem where "caption like '%%%computername%%%'" get caption, UserName, Domain /format:value
or in a batch file use loop
for /f "tokens=2 delims==" %%i in ('wmic computersystem where "Caption like '%%%currentname%%%'" get UserName /format:value') do (echo. UserName- %%i)