issue passing varible with space in it.
This works $Roleobj = (Get-CrmRecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue "_Role Name" -Fields * -AllRows).CrmRecords
This does not $Role = "_Role Name" $Roleobj = (Get-CrmRecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue $Role -Fields * -AllRows).CrmRecords
$Roleobj = (Get-CrmRecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue "$Role" -Fields * -AllRows).CrmRecords
$Roleobj = (Get-CrmRecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue "$($Role)" -Fields * -AllRows).CrmRecords
$Roleobj = (Get-CrmRecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue $($Role) -Fields * -AllRows).CrmRecords
Would prefer not to have to hardcode the role name in the command.
I just tried to reproduce the problem and cannot, are you able to use the same script I did and reproduce the problem?
get-crmrecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue "Schedule Manager"
$name = "Schedule Manager"
get-crmrecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue $name
