Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Riepilogo
Restituisce lo schema JSON per le istanze di una risorsa.
Sintassi
dsc resource schema [Options] --resource <RESOURCE>
Descrizione
Il schema sottocomando restituisce lo schema JSON per un'istanza di una risorsa DSC specifica. DSC usa questi schemi per convalidare l'input per i getsottocomandi , sete test e quando si convalidano le istanze in un documento di configurazione DSC.
L'integrazione degli strumenti può usare questi schemi per la convalida o per migliorare l'esperienza di creazione della configurazione. Lo schema dell'istanza di una risorsa definisce la struttura valida per un'istanza, incluse le proprietà obbligatorie e i relativi valori. Gli schemi di istanza possono includere anche la documentazione leggera per le proprietà con le title parole chiave e description .
Esempio
Esempio 1: ottenere lo schema per una risorsa
Questo esempio restituisce lo schema per la OSInfo risorsa DSC basata su comandi.
dsc resource schema --resource Microsoft/OSInfo
$schema: http://json-schema.org/draft-07/schema#
$id: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/resources/Microsoft/OSInfo/v0.1.0/schema.json
title: OsInfo
description: |
Returns information about the operating system.
https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource
markdownDescription: |
The `Microsoft/OSInfo` resource enables you to assert whether a machine meets criteria related to
the operating system. The resource is only capable of assertions. It doesn't implement the set
operation and can't configure the operating system.
[Online documentation][01]
[01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource
type: object
required: []
additionalProperties: false
properties:
$id:
type: string
readOnly: true
title: Data Type ID
description: |
Returns the unique ID for the OSInfo instance data type.
https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#id
markdownDescription: |
Returns the unique ID for the OSInfo instance data type.
[Online documentation][01]
[01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#id
architecture:
type: string
title: Processor architecture
description: |
Defines the processor architecture as reported by 'uname -m' on the operating system.
https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#architecture
markdownDescription: |
Defines the processor architecture as reported by `uname -m` on the operating system.
[Online documentation][01]
[01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#architecture
bitness:
type: string
enum:
- '32'
- '64'
- unknown
title: Operating system bitness
description: |
Defines whether the operating system is a 32-bit or 64-bit operating system.
https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#bitness
markdownDescription: |
Defines whether the operating system is a 32-bit or 64-bit operating system.
[Online documentation][01]
[01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#bitness
codename:
type: string
title: Linux codename
description: |
Defines the codename for the operating system as returned from 'lsb_release --codename'.
https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#codename
markdownDescription: |
Defines the codename for the operating system as returned from `lsb_release --codename`.
[Online documentation][01]
[01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#codename
edition:
type: string
title: Windows edition
description: |
Defines the operating system edition, like 'Windows 11' or 'Windows Server 2016'.
https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#edition
markdownDescription: |
Defines the operating system edition, like `Windows 11` or `Windows Server 2016`.
[Online documentation][01]
[01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#edition
family:
type: string
enum:
- Linux
- macOS
- Windows
title: Operating system family
description: |
Defines whether the operating system is Linux, macOS, or Windows.
https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#family
markdownDescription: |
Defines whether the operating system is Linux, macOS, or Windows.
[Online documentation][01]
[01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#family
version:
type: string
title: Operating system version
description: |
Defines the version of the operating system as a string.
https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#version
markdownDescription: |
Defines the version of the operating system as a string.
[Online documentation][01]
[01]: https://learn.microsoft.com/powershell/dsc/reference/microsoft/osinfo/resource#version
Opzioni
-r, --resource
Specifica il nome completo del tipo della risorsa DSC da cui recuperare lo schema dell'istanza, ad esempio Microsoft.Windows/Registry.
La sintassi del nome completo del tipo è: <owner>[.<group>][.<area>]/<name>, dove:
-
ownerè l'autore o l'organizzazione per la risorsa. - e
groupareasono componenti dei nomi facoltativi che abilitano l'applicazione dei nomi per una risorsa. - Identifica
nameil componente gestito dalla risorsa.
Type: String
Mandatory: true
-f, --format
L'opzione --format controlla il formato di output della console per il comando . Se l'output del comando viene reindirizzato o acquisito come variabile, l'output è sempre JSON.
Type: String
Mandatory: false
DefaultValue: yaml
ValidValues: [json, pretty-json, yaml]
-h, --help
Visualizza la Guida per il comando o il sottocomando corrente. Quando si specifica questa opzione, l'applicazione ignora tutte le opzioni e gli argomenti dopo questo.
Type: Boolean
Mandatory: false
Output
Questo comando restituisce un oggetto JSON che rappresenta lo schema JSON per un'istanza della risorsa DSC specificata.