Skip to content

preserve empty properties  #40

@Wopienkaatwork

Description

@Wopienkaatwork

is it possible to preserve empty properties and write them back into the file, because I want to preserve as much information about an object as possible.
I get the following object from M365Dsc Export:
AADGroup "AADGroup-sg-Legal"
{
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
Description = "All legal executives";
DisplayName = "sg-Legal";
Ensure = "Present";
GroupTypes = @();
Id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
MailEnabled = $False;
MailNickname = "sgLegal";
MemberOf = @();
Members = @("JoniS@M365xxxxxxxxx.OnMicrosoft.com","IrvinS@M365xxxxxxxxx.OnMicrosoft.com","GradyA@M365xxxxxxxxx.OnMicrosoft.com");
Owners = @();
SecurityEnabled = $True;
TenantId = $OrganizationName;
}

When I use the following code:
$converted=ConvertTo-DSCObject -Path .\M365TenantConfig.ps1
$convertedback = ConvertFrom-DSCObject $converted

after the conversion the object looks like this:
AADGroup "AADGroup-sg-Legal"
{
Description = "All legal executives"
MailEnabled = $False
Id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
ApplicationId = "$ConfigurationData.NonNodeData.ApplicationId"
Ensure = "Present"
MailNickname = "sgLegal"
SecurityEnabled = $True
TenantId = "$OrganizationName"
CertificateThumbprint = "$ConfigurationData.NonNodeData.CertificateThumbprint"
DisplayName = "sg-Legal"
Members = @("JoniS@M365xxxxxxxxx.OnMicrosoft.com","IrvinS@M365xxxxxxxxx.OnMicrosoft.com","GradyA@M365xxxxxxxxx.OnMicrosoft.com")
}

Is it possible to add a flag with convertFrom-DSCObject like preserveEmptyProperties so that I also get the empty properties back again after conversion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions