Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preserve empty properties #40

Open
Wopienkaatwork opened this issue Mar 15, 2024 · 3 comments
Open

preserve empty properties #40

Wopienkaatwork opened this issue Mar 15, 2024 · 3 comments

Comments

@Wopienkaatwork
Copy link

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 = @("[email protected]","[email protected]","[email protected]");
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 = @("[email protected]","[email protected]","[email protected]")
}

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

@andikrueger
Copy link

Good catch. This kind of information should be available.

Whit which version did you geht these results:

get-module DSCParser -listavailable

@Wopienkaatwork
Copy link
Author

Version: 1.4.0.4
The output is:
get-module DSCParser -listavailable

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Manifest 1.4.0.4 DSCParser {ConvertTo-DSCObject, ConvertFrom-DSCObject}

@andikrueger
Copy link

Thanks for the additional information. Currently, there is work for a V2 version of DSCParser and we need to make sure that this feature is going to be implemented. It's important to have empty definitions in the parsed objects.

cc/ @NikCharlebois

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants