PowerShell
PowerShell copied to clipboard
Schema for powershell.config.json
Summary of the new feature / enhancement
The powershell.config.json file has plain-text documentation but I could not find a schema.
It would be nice to have a JSON schema to assist editing the file in Visual Studio Code.
Proposed technical implementation details (optional)
No response
@rotu I was thinking the same thing today so I quickly drafted up a JSON Schema using the powershell.config.json Documentation (v7.4 LTS):
View JSON Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://json.schemastore.org/powershell.config",
"$comment": "https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_config?view=powershell-7.4",
"title": "PowerShell Configuration JSON Schema",
"description": "Schema for the powershell.config.json file using documented configuration settings for PowerShell Version 7.4 LTS.",
"type": "object",
"additionalProperties": false,
"properties": {
"DisableImplicitWinCompat": {
"type": "boolean",
"description": "Disables the Windows PowerShell Compatibility feature when set to true."
},
"WindowsPowerShellCompatibilityModuleDenyList": {
"type": "array",
"description": "List of module names to exclude from Windows PowerShell Compatibility.",
"items": {
"type": "string"
}
},
"WindowsPowerShellCompatibilityNoClobberModuleList": {
"type": "array",
"description": "List of module names that should not be clobbered by loading the Windows PowerShell 5.1 version.",
"items": {
"type": "string"
}
},
"ExperimentalFeatures": {
"type": "array",
"description": "Names of experimental features to enable in PowerShell.",
"items": {
"type": "string"
}
},
"LogChannels": {
"type": "string",
"description": "Specifies logging channels for Linux and macOS."
},
"LogIdentity": {
"type": "string",
"description": "Specifies the log identity for non-Windows platforms."
},
"LogKeywords": {
"type": "string",
"description": "Specifies logging keywords for non-Windows platforms."
},
"LogLevel": {
"type": "string",
"description": "Specifies the logging level for non-Windows platforms.",
"enum": [
"Critical",
"Error",
"Warning",
"Informational",
"Verbose",
"Debug"
]
},
"Microsoft.PowerShell:ExecutionPolicy": {
"type": "string",
"description": "Configures the execution policy for PowerShell sessions.",
"enum": [
"Restricted",
"AllSigned",
"RemoteSigned",
"Unrestricted",
"Bypass",
"Undefined"
]
},
"PSModulePath": {
"type": "string",
"description": "Overrides the PSModulePath settings for this PowerShell session. Supports environment variables enclosed in '%'."
},
"PowerShellPolicies": {
"type": "object",
"description": "Contains settings that mirror the Group Policy settings for PowerShell.",
"additionalProperties": false,
"properties": {
"ExecutionPolicy": {
"type": "object",
"description": "Sets the PowerShell Execution Policy.",
"properties": {
"ExecutionPolicy": {
"type": "string",
"enum": [
"Restricted",
"AllSigned",
"RemoteSigned",
"Unrestricted",
"Bypass",
"Undefined"
],
"description": "Specifies the execution policy."
}
},
"required": [
"ExecutionPolicy"
],
"additionalProperties": false
},
"ConsoleSessionConfiguration": {
"type": "object",
"description": "Specifies the session configuration for all PowerShell sessions.",
"properties": {
"EnableConsoleSessionConfiguration": {
"type": "boolean",
"description": "Enables session configurations when set to true."
},
"ConsoleSessionConfigurationName": {
"type": [
"string",
"array"
],
"description": "Specifies the name(s) of the configuration endpoint(s).",
"items": {
"type": "string"
}
}
},
"required": [
"EnableConsoleSessionConfiguration",
"ConsoleSessionConfigurationName"
],
"additionalProperties": false
},
"ModuleLogging": {
"type": "object",
"description": "Controls logging for PowerShell modules.",
"properties": {
"EnableModuleLogging": {
"type": "boolean",
"description": "Enables module logging when set to true."
},
"ModuleNames": {
"type": "array",
"description": "Specifies the names of modules to log.",
"items": {
"type": "string"
}
}
},
"required": [
"EnableModuleLogging",
"ModuleNames"
],
"additionalProperties": false
},
"ProtectedEventLogging": {
"type": "object",
"description": "Configures Protected Event Logging.",
"properties": {
"EnableProtectedEventLogging": {
"type": "boolean",
"description": "Enables Protected Event Logging when set to true."
},
"EncryptionCertificate": {
"type": "array",
"description": "List of certificates used for encryption.",
"items": {
"type": "string"
}
}
},
"required": [
"EnableProtectedEventLogging",
"EncryptionCertificate"
],
"additionalProperties": false
},
"ScriptBlockLogging": {
"type": "object",
"description": "Controls logging of PowerShell script blocks.",
"properties": {
"EnableScriptBlockLogging": {
"type": "boolean",
"description": "Enables logging of all PowerShell script input when set to true."
},
"EnableScriptBlockInvocationLogging": {
"type": "boolean",
"description": "Enables logging of script block start and stop events when set to true."
}
},
"required": [
"EnableScriptBlockLogging",
"EnableScriptBlockInvocationLogging"
],
"additionalProperties": false
},
"ScriptExecution": {
"type": "object",
"description": "Sets the execution policy for scripts.",
"properties": {
"ExecutionPolicy": {
"type": "string",
"enum": [
"Restricted",
"AllSigned",
"RemoteSigned",
"Unrestricted",
"Bypass",
"Undefined"
],
"description": "Specifies the execution policy."
}
},
"required": [
"ExecutionPolicy"
],
"additionalProperties": false
},
"Transcription": {
"type": "object",
"description": "Configures transcription settings.",
"properties": {
"EnableTranscripting": {
"type": "boolean",
"description": "Enables transcription for all PowerShell sessions when set to true."
},
"EnableInvocationHeader": {
"type": "boolean",
"description": "Includes a header at the top of the transcription log file when set to true."
},
"OutputDirectory": {
"type": "string",
"description": "Specifies the directory to collect transcription log files."
}
},
"required": [
"EnableTranscripting"
],
"additionalProperties": false
},
"UpdatableHelp": {
"type": "object",
"description": "Configures the default source path for Updatable Help.",
"properties": {
"DefaultSourcePath": {
"type": "string",
"description": "Sets the default value of the SourcePath parameter on the Update-Help cmdlet."
}
},
"required": [
"DefaultSourcePath"
],
"additionalProperties": false
}
}
},
"ConsoleSessionConfiguration": {
"type": "object",
"description": "Specifies the session configuration to be used for all PowerShell sessions.",
"properties": {
"EnableConsoleSessionConfiguration": {
"type": "boolean",
"description": "Enables session configurations when set to true."
},
"ConsoleSessionConfigurationName": {
"type": [
"string",
"array"
],
"description": "Specifies the name(s) of the configuration endpoint(s).",
"items": {
"type": "string"
}
}
},
"required": [
"EnableConsoleSessionConfiguration",
"ConsoleSessionConfigurationName"
],
"additionalProperties": false
},
"ModuleLogging": {
"type": "object",
"description": "Controls logging for PowerShell modules.",
"properties": {
"EnableModuleLogging": {
"type": "boolean",
"description": "Enables module logging when set to true."
},
"ModuleNames": {
"type": "array",
"description": "Specifies the names of modules to log.",
"items": {
"type": "string"
}
}
},
"required": [
"EnableModuleLogging",
"ModuleNames"
],
"additionalProperties": false
},
"ProtectedEventLogging": {
"type": "object",
"description": "Configures Protected Event Logging.",
"properties": {
"EnableProtectedEventLogging": {
"type": "boolean",
"description": "Enables Protected Event Logging when set to true."
},
"EncryptionCertificate": {
"type": "array",
"description": "List of certificates used for encryption.",
"items": {
"type": "string"
}
}
},
"required": [
"EnableProtectedEventLogging",
"EncryptionCertificate"
],
"additionalProperties": false
},
"ScriptBlockLogging": {
"type": "object",
"description": "Controls logging of PowerShell script blocks.",
"properties": {
"EnableScriptBlockLogging": {
"type": "boolean",
"description": "Enables logging of all PowerShell script input when set to true."
},
"EnableScriptBlockInvocationLogging": {
"type": "boolean",
"description": "Enables logging of script block start and stop events when set to true."
}
},
"required": [
"EnableScriptBlockLogging",
"EnableScriptBlockInvocationLogging"
],
"additionalProperties": false
},
"Transcription": {
"type": "object",
"description": "Configures transcription settings.",
"properties": {
"EnableTranscripting": {
"type": "boolean",
"description": "Enables transcription for all PowerShell sessions when set to true."
},
"EnableInvocationHeader": {
"type": "boolean",
"description": "Includes a header at the top of the transcription log file when set to true."
},
"OutputDirectory": {
"type": "string",
"description": "Specifies the directory to collect transcription log files."
}
},
"required": [
"EnableTranscripting"
],
"additionalProperties": false
},
"UpdatableHelp": {
"type": "object",
"description": "Configures the default source path for Updatable Help.",
"properties": {
"DefaultSourcePath": {
"type": "string",
"description": "Sets the default value of the SourcePath parameter on the Update-Help cmdlet."
}
},
"required": [
"DefaultSourcePath"
],
"additionalProperties": false
}
}
}
[!WARNING] Note, however that the configuration file will not support a
$schema🤔:
One can add $schema as a property in the schema, like so: