Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

MSFT_SPOUserProfilePropertyInstance: Malformed ps1 file when ’ found in Value field

Open hbagarich opened this issue 7 years ago • 4 comments

Details of the scenario you tried and the problem that is occurring

When using the Export-O365Configuration cmdlet and if the resource MSFT_SPOUserProfilePropertyInstance for key "AboutMe" contains ’ the generated ps1 file is malformed. If I run the ps1 file i get this error

+ ... high-end digital SLR cameras for the professional market. I’m excited ...
+                                                                 ~
Unexpected token 'm' in expression or statement.

If needed I can provide you with generated ps1 file.

Verbose logs showing the problem

Suggested solution to the issue

The solution to the issue is to correctly escape the character so ps1 file is not malformed

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Export-O365Configuration

The operating system the target node is running

OsName : Microsoft Windows 10 Enterprise OsOperatingSystemSKU : EnterpriseEdition OsArchitecture : 64-bit WindowsVersion : 1903 WindowsBuildLabEx : 18362.1.amd64fre.19h1_release.190318-1202 OsLanguage : en-US OsMuiLanguages : {en-US, hr-HR}

Version of the DSC module that was used ('dev' if using current dev branch)

Used the currently published version on PowerShell Gallery: 1.0.0.1048

hbagarich avatar Nov 14 '19 09:11 hbagarich

Hi @hbagarich could you provide the full SPOUserProfileProperty block? I am having a hard time replicating the issue on my end. Thanks

NikCharlebois avatar Nov 14 '19 13:11 NikCharlebois

This is what I get:

MSFT_SPOUserProfilePropertyInstance
            {
                Key   = 'AboutMe'
                Value = 'I have been with Contoso for five years, starting as marketing assistant and moving up to supervisory positions. I am currently Retail Manager for our latest line of high-end digital SLR cameras for the professional market. I’m excited about the opportunity to introduce these cutting-edge products to the market. We have a great team ready to go!'
            }

The problem seems to be I’m excited about.

hbagarich avatar Nov 14 '19 13:11 hbagarich

@hbagarich The issue is related to the outbound delimiter being set to single quote '

This has been changed a few weeks ago to now return double quotes. Please make sure you are testing using the latest code from the Dev branch. The issue should be fixed now. Please confirm that doing an extract with the latest codebase solves the issue. Thanks.

NikCharlebois avatar Nov 14 '19 14:11 NikCharlebois

I can verify that it works with the latest DEV version!

hbagarich avatar Nov 18 '19 10:11 hbagarich