Windows컴퓨터 이름 변경 ( wmic 명령어 )

작성자: JJUNI님    작성일시: 작성일2019-12-11 20:10:36    조회: 32,362회    댓글: 0

윈도우 컴퓨터 이름 및 사용자 계정명 변경 배치파일 ( wmic 이용 )


## 사용자 계정 변경 ##


Helper 계정의 이름을 jjuni 로 변경하고자 한다.

변경된 jjuni 계정의 패스워드를 qwer1234라고 지정한다.


wmic UserAccount where Name="Helper" call Rename Name="jjuni" 

net user jjuni "qwer1234"



## 컴퓨터 이름 변경 ##


현재의 컴퓨터 이름을 JJUNI-PC 로 변경하고자 한다.


wmic computersystem where caption="%computername%" call rename name=JJUNI-PC 


위의 2가지를 적용하여 배치파일을 만들려면 아래와 같이 작성..

( 단, 여기서 컴퓨터 이름 및 사용자 계정은 키보드로 입력을 받아서 변경한다. )


@echo off

prompt $p$g

setlocal


:message

set /p comname=## Computer Name ## =    

set /p username=## UserAccount ## =   


if /i [%comname%]==[] goto error

if /i [%username%]==[] goto error


wmic computersystem where caption="%computername%" call rename name=%comname%

wmic UserAccount where Name="helper" call Rename Name=%username%


pause > nul 

goto end 


:error

echo error

pause > nul

goto end 


:end

exit





컴퓨터 이름 변경 ( wmic 명령어 )


아래의 명령은 금일일자 시간으로 컴퓨터 이름 변경 코드 입니다. ^^


set Y=%date:~2,2%

set M=%date:~5,2%

set D=%date:~8,2%

set H=%time:~0,2%

set M1=%time:~3,2%


Set Re_Name=%Y%%M%%D%%H%%M1%


/* 컴퓨터 이름 변경 */

wmic ComputerSystem Where Name="%COMPUTERNAME%" Call Rename Name="Re_Name"  


/* 컴퓨터 이름을 변경했으니 재부팅을 해야 변경이 적용 되기에 재부팅 명령입니다. */

wmic os where "status='ok'" call reboot 

댓글목록

등록된 댓글이 없습니다.