Liste Görünümü (Temel)

Bu örnekte, System.Serviceprocess.Servicecontroller'i görüntüleyen temel bir liste görünümü nasıl uygulanır? Displayproperty=Get-Service cmdlet'i tarafından döndürülen Fullname nesneleri. Liste görünümünün bileşenleri hakkında daha fazla bilgi için bkz. Liste Görünümü Oluşturma.

Bu biçimlendirme dosyasını yükleme

  1. Bu konunun Örnek bölümündeki XML dosyasını bir metin dosyasına kopyalayın.

  2. Metin dosyasını kaydedin. Uzantıyı biçimlendirme format.ps1xml dosyası olarak tanımlamak için dosyaya ekleyin.

  3. Aşağıdaki Windows PowerShell açın ve biçimlendirme dosyasını geçerli oturuma yüklemek için aşağıdaki komutu çalıştırın: Update-formatdata -prependpath PathToFormattingFile .

Uyarı

Bu biçimlendirme dosyası, bir Windows PowerShell dosyası tarafından önceden tanımlanmış bir nesnenin görüntülemesini tanımlar. prependPathcmdlet'ini çalıştırmak için parametresini kullansanız da bu biçimlendirme dosyasını modül olarak yükleyesiniz.

Gösteriler

Bu biçimlendirme dosyası aşağıdaki XML öğelerini gösterir:

  • Görünümün Name öğesi.

  • Görünüm tarafından hangi nesnelerin görüntülendiğinden emin olan ViewSelectedBy öğesi.

  • Görünüm tarafından hangi özelliğin görüntülendiğinden tanımlayan ListControl öğesi.

  • Liste görünümünün bir satırda nelerin görüntülendiğinden tanımlayan ListItem öğesi.

  • Hangi özelliğin görüntülendiğinden tanımlayan PropertyName öğesi.

Örnek

Aşağıdaki XML, System.Serviceprocess.Servicecontroller'ın dört özelliklerini görüntüleyen bir liste görünümü tanımlar. Displayproperty=Fullname nesnesi. Her satırda özelliğin adı ve ardından özelliğin değeri görüntülenir.

<Configuration>
  <View>
    <Name>System.ServiceProcess.ServiceController</Name>
    <ViewSelectedBy>
      <TypeName>System.ServiceProcess.ServiceController</TypeName>
    </ViewSelectedBy>
    <ListControl>
      <ListEntries>
        <ListEntry>
          <ListItems>
            <ListItem>
              <PropertyName>Name</PropertyName>
            </ListItem>
            <ListItem>
              <PropertyName>DisplayName</PropertyName>
            </ListItem>
            <ListItem>
              <PropertyName>Status</PropertyName>
            </ListItem>
            <ListItem>
              <PropertyName>ServiceType</PropertyName>
            </ListItem>
          </ListItems>
        </ListEntry>
      </ListEntries>
    </ListControl>
  </View>
</Configuration>

Aşağıdaki örnekte System.Serviceprocess.Servicecontroller Windows PowerShell nasıl görüntülmektedir? Bu biçim dosyası yüklendikten sonra Displayproperty=Fullname nesneleri.

Get-Service f*
Name        : Fax
DisplayName : Fax
Status      : Stopped
ServiceType : Win32OwnProcess

Name        : FCSAM
DisplayName : Microsoft Antimalware Service
Status      : Running
ServiceType : Win32OwnProcess

Name        : fdPHost
DisplayName : Function Discovery Provider Host
Status      : Stopped
ServiceType : Win32ShareProcess

Name        : FDResPub
DisplayName : Function Discovery Resource Publication
Status      : Running
ServiceType : Win32ShareProcess

Name        : FontCache
DisplayName : Windows Font Cache Service
Status      : Running
ServiceType : Win32ShareProcess

Name        : FontCache3.0.0.0
DisplayName : Windows Presentation Foundation Font Cache 3.0.0.0
Status      : Stopped
ServiceType : Win32OwnProcess

Name        : FSysAgent
DisplayName : Microsoft Forefront System Agent
Status      : Running
ServiceType : Win32OwnProcess

Name        : FwcAgent
DisplayName : Firewall Client Agent
Status      : Running
ServiceType : Win32OwnProcess

Ayrıca Bkz.

Biçimlendirme Dosyası Örnekleri

PowerShell Biçimlendirme Dosyası Yazma