Search for documents with blank/null attribute value

I know that I can use this syntax to search for documents with a specific attribute value:

$PWDocuments = Get-PWDocumentsBySearch -FolderPath $MyFolderPath -Attributes @{ "My_Attribute"="Desired Value" }

My question is, how can I search for documents having a blank or null value for a particular attribute?  This does not return any documents, even though I know they exist:

$PWDocuments = Get-PWDocumentsBySearch -FolderPath $MyFolderPath -Attributes @{ "My_Attribute"="" }

Any suggestions would be appreciated.  Thanks!

Parents
  • PS C:\Users\georgea2> $PWDocuments = Get-PWDocumentsBySearch -FolderPath $folderlocation -Attributes @{ "Document_Type"=$null }
    Get-PWDocumentsBySearch : Object reference not set to an instance of an object.
    At line:1 char:16
    + ... Documents = Get-PWDocumentsBySearch -FolderPath $folderlocation -Attr ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Get-PWDocumentsBySearch], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,PWPS_DAB.GetPWDocumentsBySearch

    I am getting this error while trying out this. Any help will be appreciated.

Reply
  • PS C:\Users\georgea2> $PWDocuments = Get-PWDocumentsBySearch -FolderPath $folderlocation -Attributes @{ "Document_Type"=$null }
    Get-PWDocumentsBySearch : Object reference not set to an instance of an object.
    At line:1 char:16
    + ... Documents = Get-PWDocumentsBySearch -FolderPath $folderlocation -Attr ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Get-PWDocumentsBySearch], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,PWPS_DAB.GetPWDocumentsBySearch

    I am getting this error while trying out this. Any help will be appreciated.

Children