문제

기본 도구를 사용하여 명령줄에서 Windows 2003의 호스트 이름을 변경할 수 있습니까?

도움이 되었습니까?

해결책

netdom.exe 명령줄 프로그램을 사용할 수 있습니다.이 도구는 Windows XP 지원 도구 또는 Server 2003 지원 도구(둘 다 설치 CD에 있음)에서 사용할 수 있습니다.

사용 지침 여기

다른 팁

앞서 언급한 wmic 명령은 최신 버전의 Windows에 기본적으로 설치되므로 이동하는 방법입니다.

환경에서 현재 이름을 검색하여 이를 일반화하기 위한 작은 개선 사항은 다음과 같습니다.

wmic computersystem where name="%COMPUTERNAME%" 
     call rename name="NEW-NAME"

메모:명령은 한 줄로 입력해야 하지만 스크롤이 필요 없도록 두 줄로 나누었습니다.@rbeede가 언급했듯이 업데이트를 완료하려면 재부팅해야 합니다.

cmd(명령):

netdom renamecomputer %COMPUTERNAME% /Newname "NEW-NAME"

파워쉘(윈도우 2008/2012):

netdom renamecomputer "$env:COMPUTERNAME" /Newname "NEW-NAME"

그 후에는 컴퓨터를 재부팅해야 합니다.

WHS 스크립트를 사용하여 이를 수행하는 또 다른 방법은 다음과 같습니다.

Set objWMIService = GetObject("Winmgmts:root\cimv2")

For Each objComputer in _
    objWMIService.InstancesOf("Win32_ComputerSystem")

    objComputer.rename "NewComputerName", NULL, NULL 
Next

원천

이 작업을 수행하는 명령은 모르지만 VBScript나 이와 유사한 것으로 수행할 수 있습니다.다음과 같은 것:

sNewName = "put new name here" 

Set oShell = CreateObject ("WSCript.shell" ) 

sCCS = "HKLM\SYSTEM\CurrentControlSet\" 
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\" 
sCompNameRegPath = sCCS & "Control\ComputerName\" 

With oShell 
.RegDelete sTcpipParamsRegPath & "Hostname" 
.RegDelete sTcpipParamsRegPath & "NV Hostname" 

.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName 
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName 
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName 
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName 
End With ' oShell 

MsgBox "Computer name changed, please reboot your computer" 

원래의

컴퓨터 호스트 이름을 원격으로 변경하려면 아래 명령을 사용하십시오. 변경 후 시스템 재부팅이 필요합니다.

psexec.exe -h -e \\\IPADDRESS -u USERNAME -p PASSWORD netdom renamecomputer CurrentComputerName /newname:NewComputerName /force

복잡할 수 있는데 왜 쉬울까요?올바른 질문이 필요한데 netdom.exe와 같은 타사 애플리케이션을 사용하는 이유는 무엇입니까?2번의 질문을 시도해 보세요:

캡션='%컴퓨터 이름%'인 wmic 컴퓨터 시스템 캡션, 사용자 이름, 도메인 /형식:값 가져오기

"'%%%computername%%%'와 같은 캡션"이 캡션, 사용자 이름, 도메인 /format:value를 가져오는 wmic 컴퓨터 시스템

또는 배치 파일 사용 루프에서

for /f "tokens=2 delims==" %%i in ('wmic 컴퓨터 시스템 where "Caption like '%%%currentname%%%'" get UserName /format:value') do (echo.사용자 이름- %%i)

Windows 10 IoT에서 이 작업을 수행하려는 경우 사용할 수 있는 기본 명령이 있습니다.

setcomputername [newname]

불행하게도 이 명령은 존재하지 않는다 Windows 10의 전체 빌드에서.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top