Removes authoring metadata from .mof files.
Clear-MofAuthoringMetadata [-Path] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
Everytime PowerShell generates a .mof file, it includes authoring metadata: who created the file, on what computer, and at what date/time. This means a .mof file's checksum will change everytime a new one is generated, even if the configuration in that file didn't change. This makes it hard to know when a configuration in a .mof file has truly changed, and makes its change history noisy. This function strips/removes all authoring metadata from a .mof file.
When given a path to a file, all authoring metadata is removed from that file. When given the path to a directory, removes authoring metadata from all *.mof
files in that directory.
Essentially, these blocks from each .mof file:
/*
@TargetNode='********'
@GeneratedBy=********
@GenerationDate=08/19/2014 13:29:15
@GenerationHost=********
*/
/* ...snip... */
instance of OMI_ConfigurationDocument
{
Version="1.0.0";
Author="********;
GenerationDate="08/19/2014 13:29:15";
GenerationHost="********";
};
Would be changed to:
/*
@TargetNode='JSWEB01L-WHS-08'
*/
/* ...snip... */
instance of OMI_ConfigurationDocument
{
Version="1.0.0";
};
Clear-MofAuthoringMetadata
is new in Carbon 2.0.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Path | String | The path to the file/directory whose .mof files should be operated on. |
true | false | |
WhatIf | SwitchParameter | false | false | ||
Confirm | SwitchParameter | false | false | ||
CommonParameters | This cmdlet supports common parameters. For more information type Get-Help about_CommonParameters . |
Clear-MofAuthoringMetadata -Path 'C:\Projects\DSC\localhost.mof'
Demonstrates how to clear the authoring data from a specific file.
Clear-MofAuthoringMetadata -Path 'C:\Projects\DSC'
Demonstrates how to clear the authoring data from all .mof files in a specific directory.