Condividi tramite


Metodo ConfiguredObject.GetAllSections1

Recupera tutte le sezioni di configurazione in un oggetto configurato.

Sintassi

ConfiguredObject.GetAllSections(Sections);  
ConfiguredObject.GetAllSections Sections  

Parametri

Nome Descrizione
Sections Variabile ConfigurationSection in cui vengono copiate le sezioni di configurazione per l'oggetto configurato.

Valore restituito

Questo metodo non restituisce valori.

Commenti

Il GetAllSections metodo è utile per individuare il set completo di sezioni disponibili per un oggetto configurato. Per l'impostazione regolare e il recupero delle proprietà di configurazione, vedere il metodo ConfiguredObject.GetSection .

Nota

La firma del GetAllSections metodo contiene un [OUT] parametro che riceve le sezioni restituite dal metodo.

Esempio

Nell'esempio seguente viene recuperato l'oggetto Site per il sito Web predefinito e viene utilizzato il GetAllSections metodo per recuperare ed enumerare gli oggetti sezione di configurazione per il sito.

Viene restituita una sola istanza di ogni sezione. I valori restituiti sono la configurazione effettiva per il livello dell'oggetto ConfiguredObject in uso. Il percorso di tutti gli oggetti restituiti corrisponderà a ConfiguredObjectquello di .

Nota

Verranno restituiti solo gli oggetti a livello di ConfiguredObject specificato.

' Connect to the WMI WebAministration namespace.  
Set oWebAdmin = _  
    GetObject("winmgmts:root\WebAdministration")  
  
' Get the default Web site.  
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")  
  
' Retrieve all configuration sections for the default Web  
' site and place them into an array variable.  
oSite.GetAllSections arySect  
  
' Display the number of configuration sections.  
WScript.Echo "There are " & UBound(arySect) + 1 & _  
    " configuration sections for [" & oSite.Name & "]."  
WScript.Echo vbCrLf  
  
' Iterate through the sections.  
For aryIdx = 0 To UBound(arySect)  
  
    ' Number the section for display.  
    WScript.Echo aryIdx + 1 & "."  
  
    ' Show the section name.  
    WScript.Echo "[" & arySect(aryIdx).Path_.Class & "]"  
  
    ' Show the section path and location.  
    WScript.Echo "Path: " & arySect(aryIdx).Path  
    WScript.Echo "Location: " & arySect(aryIdx).Location  
  
    ' Show the SectionInformation properties.  
    WScript.Echo "SectionInformation.OverrideMode: " & _  
        arySect(aryIdx).SectionInformation.OverrideMode  
    WScript.Echo _  
        "SectionInformation.EffectiveOverrideMode: " & _  
        arySect(aryIdx).SectionInformation.EffectiveOverrideMode  
    WScript.Echo "SectionInformation.IsLocked: " & _  
        arySect(aryIdx).SectionInformation.IsLocked  
    WScript.Echo "SectionInformation.LockItem: " & _  
        arySect(aryIdx).SectionInformation.LockItem  
  
    WScript.Echo vbCrLf  
Next  
  

Requisiti

Tipo Descrizione
Client - IIS 7.0 in Windows Vista
- IIS 7.5 in Windows 7
- IIS 8.0 in Windows 8
- IIS 10.0 in Windows 10
Server - IIS 7.0 in Windows Server 2008
- IIS 7.5 in Windows Server 2008 R2
- IIS 8.0 in Windows Server 2012
- IIS 8.5 in Windows Server 2012 R2
- IIS 10.0 in Windows Server 2016
Prodotto - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
File MOF WebAdministration.mof

Vedere anche

Classe ConfiguredObject
Metodo ConfiguredObject.GetSection