본문 바로가기

Powershell

Powershell ISE에서 Exchange, IIS 명령 사용

Powershell 2.0
Exchange Server 2007
IIS 7
2009. 11. 30.
안혁
http://hyok.kr



Powershell 2.0에 있는 Powershell ISE에서는 기본적인 명령어만 사용이 가능합니다. Powershell이 설치된 컴퓨터에 Exchange Server 2007이나 IIS 7이 설치되어 있다면 Powershell ISE에서도 이 명령을 사용할 수 있는 방법이 있습니다.

Windows Vista, Windows Server 2008에서는 IIS 7 관련 Powershell 명령을 사용하려면 추가로 Snap-In을 설치하여야 합니다.
http://www.iis.net/extensions/PowerShell

Powershell ISE를 실행 후 하단의 명령창에서 다음 명령을 실행합니다.

Exchange Server 2007
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin

IIS 7
Import-Module WebAdministration (또는 Add-PSSnapin WebAdministration)

혹시 명령 실행이 다음과 같이 원할하지 않을 수도 있습니다..

Import-Module : File C:\Windows\system32\WindowsPowerShell\v1.0\Modules\webadministration\WebAdministrationAliases.ps1 cannot be loaded bec
ause the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:14
+ import-module <<<<  webadministration
    + CategoryInfo          : NotSpecified: (:) [Import-Module], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException,Microsoft.PowerShell.Commands.ImportModuleCommand

이와 같거나 또는 정상적으로 진행되지 않는다고 판단되면 다음의 명령을 실행 후 다시 해보세요. 실행 권한이 없어서 발생하는 문제일 가능성이 있습니다.

Set-ExecutionPolicy -ExecutionPolicy UnRestricted

사용하는 추가 명령이 두가지인데, Import-Module 명령은 Powershell 1.0에는 없는 명령입니다. 2.0이 나온지 얼마되지 않아 방식이 혼재하고 있는 상태로 보여집니다.

Powershell 2.0 에서 부터 OS에 설치되어 있는 모든 파워쉘 모듈을 올리는 명령이 제공됩니다. 아래 명령이 기억하기는 쉬울 것 같습니다.

ImportSystemModules

일반 Powershell 명령 이름과는 달리 하이픈(-)이 없습니다.

'Powershell' 카테고리의 다른 글

Powershell - 파일 이름 일괄 변경  (0) 2011.02.11
Powershell - 문자를 아스키 값으로 처리  (2) 2010.12.27
Powershell 2.0 출시  (0) 2009.11.04