다음을 통해 공유


와이드 보기(GroupBy)

이 예제에서는 Get-Service cmdlet에서 반환된 System.ServiceProcess.ServiceController 개체 그룹을 표시하는 넓은 보기를 구현하는 방법을 보여 줍니다. 넓은 보기의 구성 요소에 대한 자세한 내용은 만들기를 참조하세요.

이 서식 파일 로드

  1. 이 항목의 예제 섹션에서 텍스트 파일로 XML을 복사합니다.

  2. 텍스트 파일을 저장합니다. 파일에 format.ps1xml 확장자를 추가하여 서식 파일로 식별해야 합니다.

  3. Windows PowerShell을 열고 다음 명령을 실행하여 서식 파일을 현재 세션으로 로드합니다. Update-FormatData -PrependPath <Path to file>.

    경고

    이 서식 파일은 Windows PowerShell 서식 지정 파일에서 이미 정의한 개체의 표시를 정의합니다. cmdlet을 실행할 때 PrependPath 매개 변수를 사용해야 하며 이 서식 파일을 모듈로 로드할 수 없습니다.

입증합니다

이 서식 파일은 다음과 같은 XML 요소를 보여 줍니다.

  • 뷰의 Name 요소입니다.

  • 뷰에 표시되는 개체를 정의하는 ViewSelectedBy 요소입니다.

  • 새 그룹이 표시되는 시기를 정의하는 GroupBy 요소입니다.

  • 뷰에 표시되는 속성을 정의하는 WideItem 요소입니다.

예시

다음 XML은 개체 그룹을 표시하는 넓은 보기를 정의합니다. 각 새 그룹은 System.ServiceProcess.ServiceController.ServiceType 속성의 값이 변경될 때 시작됩니다.

<?xml version="1.0" encoding="utf-8" ?>

<Configuration>
  <ViewDefinitions>
    <View>
      <Name>ServiceWideView</Name>
      <ViewSelectedBy>
        <TypeName>System.ServiceProcess.ServiceController</TypeName>
      </ViewSelectedBy>
      <GroupBy>
        <Label>Service Type</Label>
        <PropertyName>ServiceType</PropertyName>
      </GroupBy>
      <WideControl>
        <WideEntries>
          <WideEntry>
            <WideItem>
              <PropertyName>ServiceName</PropertyName>
            </WideItem>
          </WideEntry>
        </WideEntries>
      </WideControl>
    </View>
  </ViewDefinitions>
</Configuration>

다음 예제에서는 Windows PowerShell이 이 형식 파일을 로드한 후 System.ServiceProcess.ServiceController 개체를 표시하는 방법을 보여 줍니다.

Get-Service f*
   Service Type: Win32OwnProcess

Fax                             FCSAM

   Service Type: Win32ShareProcess

fdPHost                         FDResPub
FontCache

   Service Type: Win32OwnProcess

FontCache3.0.0.0                FSysAgent
FwcAgent

또한 참조하십시오

파일 서식 지정 예제

PowerShell 서식 파일 작성