파워셀로 윈도우 레지스트리 수정하기

//-------------------------------------
* 추가(생성)

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-itemproperty?view=powershell-7.2
        - 값유형 ( -PropertyType )
    Binary: 이진값 ( REG_BINARY )
    DWord: DWORD (32bit) ( REG_DWORD )
    Qword: QWORD (64bit) ( REG_QWORD )
    String: 문자열 (REG_SZ)
    ExpandString: 확장 가능한 문자열 ( REG_EXPAND_SZ )
    MultiString: 다중 문자열 ( REG_MULTI_SZ )
    Unknown: ( REG_RESOURCE_LIST )


    - 키 추가
> New-Item -Path "HKCU:\Software\_Test" -Name "test1"


    - 값 추가
> New-ItemProperty -Path "HKCU:\Software\_Test\test1" -Name "vname1" -Value "val1" -PropertyType "String"


//-------------------------------------
* 조회(리스트)

    - 키 조회
        - dir = gci = Get-ChildItem
> dir 'HKCU:\Software\_Test'
> Get-ChildItem 'HKCU:\Software\_Test'
        - 하위 모든 키와 값이 리스팅 됨

> Get-Item 'HKCU:\Software\_Test'
        - 해당키의 값들만 리스팅


    - 값 조회
> Get-ItemProperty  "HKCU:\Software\_Test\test1"


    - 특정 설정 값 조회
> Get-ItemPropertyValue "HKCU:\Software\_Test\test1" -Name "vname1"



//-------------------------------------
* 삭제
    - 와일드카드 사용 가능

    - 키 삭제
> del 'HKCU:\Software\_Test\test*' -Recurse
> Remove-Item 'HKCU:\Software\_Test\test*' -Recurse


    - 값 삭제
> Remove-ItemProperty 'HKCU:\Software\_Test\test1'  -Name "v*"


//-------------------------------------
* 변경

    - 키 이름 변경
> Rename-Item "HKCU:\Software\_Test\test1"  "test_new_key"

    - 값 이름 변경
> Rename-ItemProperty  "HKCU:\Software\_Test\test1" -Name "vname1" -NewName "vname_new_name"


    - 키의 기본값 변경
Set-Item "HKCU:\Software\_Test\test1" -Value "기본값1"

    - 값 변경
Set-ItemProperty -Path "HKCU:\Software\_Test\test1" -Name "vname1" -Value 3 -Type qword


반응형
Posted by codens

댓글을 달아 주세요