Server/WindowServer | Posted by 아키텍처 2014. 5. 27. 14:39

Power Shell 을 이용한 IIS Binding 처리

 
 

Power Shell 을 이용한 IIS Binding 처리


------------------------------------------------------------------

-- 1. 관리자 권한으로 파워쉘 실행

------------------------------------------------------------------


------------------------------------------------------------------

-- 2. 사용 가능한 모듈 확인 (IIS 처리를 위해 WebAdministration 이 가능해야 함)

------------------------------------------------------------------

PS C:\Users\Administrator> Get-Module -ListAvailable


------------------------------------------------------------------

-- 3. 사용할 모듈을 Import

------------------------------------------------------------------

PS C:\Users\Administrator> import-Module WebAdministration

(최초 실행시 Excution Policies로 인해서 실행이 되지 않습니다.)

PS C:\> Set-ExecutionPolicy RemoteSigned

(실행가능하도록 권한을 'Y' 설정해주고, 파워쉘 종료. 재실행처리)


------------------------------------------------------------------

-- 4. 다시 모듈을 Import

------------------------------------------------------------------

PS C:\Users\Administrator> import-Module WebAdministration


------------------------------------------------------------------

-- 5. IIS 접근 및 확인

------------------------------------------------------------------

PS C:\Users\Administrator> IIS:

PS IIS:\> ls


Name

----

AppPools

Sites

SslBindings


------------------------------------------------------------------

-- 6. Sites 접근

------------------------------------------------------------------

PS IIS:\> cd Sites

PS IIS:\Sites> ls

설정된 IIS가 쭉나온다~!!


------------------------------------------------------------------

-- 7. 실행예제

------------------------------------------------------------------

-- 단일수정처리 (해당 실행시 전체 Binding에 대한 수정이므로, 다수의 Binding이 있으면 다 날라가고, 해당 Binding만 남게되므로 주의~!!)

PS IIS:\> Set-ItemProperty "IIS:\Sites\[사이트명]" -Name bindings -Value @{protocol="http";bindingInformation="*:80:[도메인주소]"}

-- 단일추가처리

PS IIS:\> New-ItemProperty "IIS:\Sites\[사이트명]" -Name bindings -Value @{protocol="http";bindingInformation="*:80:[도메인주소]"}

-- 다중추가처리

New-ItemProperty "IIS:\Sites\[사이트명]" -Name bindings -Value @{protocol="http";bindingInformation="*:80:[도메인주소]"};

New-ItemProperty "IIS:\Sites\[사이트명]" -Name bindings -Value @{protocol="http";bindingInformation="*:80:[도메인주소]"}


------------------------------------------------------------------
-- 8. 참고사이트
------------------------------------------------------------------
http://svrstudy.tistory.com/17
http://svrstudy.tistory.com/80
http://www.hanbit.co.kr/network/view.html?bi_id=1899



Posted by 김준홍 (http://www.Juuun.com)