Fault when running powershell cmdlet create-custom-resources.ps1

Oct 18, 2010 at 11:07 AM


I just found this codeplex site and downloaded the stuff, after reading a lot i tried the cmdlet create-custom-resources.ps1. When I executed it the following exception is thrown:

Exception calling "Parse" with "1" argument(s): "String was not recognized as a
 valid Boolean."
At C:\fim2010client-c0471ec93c2f\fim2010client_c0471ec93c2f\code-generation\fim
-resource.ps1:200 char:36
+         Multivalued = [bool]::Parse <<<< ($(GetAttributeValue $exportObject "
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordE
    + FullyQualifiedErrorId : DotNetMethodException

After trying some options i found out that the Person class i have, do not have any custom attributes so that is why it is failing, it is trying to parse "null" to something.

I have changed the following in the script:

#first test if there is something, then process it
if ($exportObjects -ne $null)

and added this statement on line 170, the final code block looks like below:

#first test if there is something, then process it
if ($exportObjects -ne $null)
	foreach ($exportObject in $exportObjects) 
		$attributeName = GetAttributeValue $exportObject "Name"
		if ($ignoreAttributeNames -contains $attributeName) {
			Write-Debug "Skipping attribute $attributeName."
		$attribute = @{
			Name = $attributeName;
			CsName = $csName;
			DisplayName = GetAttributeValue $exportObject "DisplayName" $attributeName;
			Description = GetAttributeValue $exportObject "Description" $attributeName;
			DataType = GetAttributeValue $exportObject "DataType";
			Multivalued = [bool]::Parse($(GetAttributeValue $exportObject "Multivalued"));
			MemberName = "_" + ${csName}.ToLower()[0] + ${csName}.Substring(1);
		$attributes = $attributes + $attribute
	Write-Warning "No custom attributes found for type ${fimtype}"

I don't know yet how to contribute or change the original script

Oct 18, 2010 at 11:57 AM

Thank you very much for reporting this!

I will include your fix in the project soon.