Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/PoshCode/Metadata
Serialization for the PowerShell metadata format
https://github.com/PoshCode/Metadata
Last synced: 5 days ago
JSON representation
Serialization for the PowerShell metadata format
- Host: GitHub
- URL: https://github.com/PoshCode/Metadata
- Owner: PoshCode
- License: mit
- Created: 2021-06-26T03:52:43.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-17T04:47:55.000Z (about 2 years ago)
- Last Synced: 2024-08-02T17:35:32.489Z (3 months ago)
- Language: PowerShell
- Size: 684 KB
- Stars: 18
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - PoshCode/Metadata - Serialization for the PowerShell metadata format (PowerShell)
README
[![Build on push](https://github.com/PoshCode/Metadata/actions/workflows/build.yml/badge.svg)](https://github.com/PoshCode/Metadata/actions/workflows/build.yml)
# The Metadata Module
Long the core of my Configuration module, the Metadata module is now shipping on it's own.
## Metadata commands for working with PowerShell's metadata manifest content (.psd1 files):
- Manipulating metadata files
- Extensible serialization of types
- Built in support for DateTime, Version, Guid, SecureString, ScriptBlocks and more
- Lets you store almost anything in readable metadata (.psd1) files
- Serializing (`Export`) to metadata (.psd1) files
- Deserializing (`Import`) from metadata (.psd1) filesIt supports WindowsPowerShell, as well as PowerShell Core on Windows, Linux and OS X.
## Installation
```posh
Install-Module Metadata
```## Usage: Serialization
The main serialization commands (with the `Metadata` noun) are: ConvertFrom, ConvertTo, Import and Export. By default, the serializer can handle a variety of custom PSObjects, hashtables, and arrays recursively, and has specific handling for booleans, strings and numbers, as well as Versions, GUIDs, and DateTime, DateTimeOffset, and even ScriptBlocks and PSCredential objects.
**Important note:** PSCredentials are stored using ConvertTo-SecureString, and currently only work on Windows. They should be stored in the user scope, since they're serialized per-user, per-machine, using the Windows Data Protection API.
In other words, it handles everything you're likely to need in a configuration file. However, it also has support for adding additional type serializers via the `Add-MetadataConverter` command. If you want to store anything that doesn't work, please raise an issue :wink:.
In addition, there are `Get-Metadata` and `Update-Metadata` commands that read individual values from metadata files.
Finally, there is a `Update-Object` command that can update an object or hashtable with values from a second object or hashtable.