Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Remove-OfficeYamlNode

Module
PSWriteOffice
Inputs
OfficeIMO.Yaml.YamlDocument

Removes mapping entries or sequence items from a live YAML document by path.

Syntax

Remove-OfficeYamlNode
[-Document <YamlDocument>]
[-Select] <String[]>
[<CommonParameters>]
#
Parameter set: Document

Description

An entry goes with its own comment lines and line; neighboring entries and section comments stay. A path with nothing at it writes a non-terminating ObjectNotFound error.

Examples

Drop a setting inside an editing block.

Open-OfficeYaml -Path ./values.yaml {
    Remove-OfficeYamlNode -Select 'ingress.annotations["nginx.ingress.kubernetes.io/rewrite-target"]'
}

Remove a sequence item if it is there.

Remove-OfficeYamlNode -Document $document -Select 'spec.ports[1]' -ErrorAction SilentlyContinue

Parameters

-Document YamlDocument optionalpipeline: True (ByValue)
Gets or sets an explicit live document; omission uses the enclosing content block.
-Select String[] requiredposition: 0
Paths of the entries or items to remove.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.