Multiple Folders in New-PWScanForReferences -Priority

I am trying to use the New-PWScanForReferences  cmdlet and have it scan multiple Folders to find the references.  The executable wants these separated with a semicolon but this doesn't seem to work.  Per the executable's help, I would also proceed the folder with 'r:' for recursive, but this also does not work and appears to need the -RecursePriority.  It seems a trailing backslash is needed even though the help for the executable does not have this requirement.

From the executable's help:

For example, the combination of:
-masterfolders "Top level folder 3" -masterfolders "Top level folder 1;Top level folder 2"
is equivalent to:
-masterfolders "Top level folder 3;Top level folder 1;Top level folder 2"

My code is:

$myPriority = 'Folder 1\subfolder\;Folder 2\;Folder 3\'

$NewScanRef = @{
DataSourceName = 'myDatasource';
UserName = 'myUserName';
Password = 'mypassword;
ScanMode = 'references;linksets';
MasterDocuments = '{' + $myDocumentGUID + '}';
Priority = $myPriority;
#Proximity = 'r:1';
Order = 'priority;proximity';
#Applications = '';
LogFilePath = $myLogpath ;
New-PWScanForReferences @NewScanRef -RecurseMasterFolders -RecursePriority

I have also tried using 

$myPriority = @("Folder 1\subfolder\","Folder 2\","Folder 3\")


$myPriority = "Folder 1\subfolder\","Folder 2\","Folder 3\"

With no success.  What am I missing?

  • I don't think -MasterDocuments accepts a GUID. I think it needs to be a filename or file pattern.

    i would not do both priority and proximity especially since you don't seem to specify anything for  the -Proximity parameter.

    Finally, the New-PWScanForReferences must be run from 32-bit powershell, are you doing that?


  • Yes, I am using the 32 -bit PowerShell.

    Everything works until I want to scan multiple folders for possible references.  I need to figure out how to scan multiple folders in the priority.  Ideally I would also scan multiple files with the same call, and that would be my next step once I get this working.  I suspect it should be the same for the files as it is for the folders.  Per the executable's help, I should be able to pass a list of files as well, and should be able to use the GUID for that, by enclosing each in {}.

    The File GUID works and was better than using the name for a few reasons in this case.

    I can drop the proximity setting if I get this working but having it set this way has not stpped execution if there is only 1 folder passed to priority.  There is a problem with Proximity in that the executable allows the number to be more than 0 or 1 but the cmdlet limits it to 0 or 1.  On the command line I was able to set a higher number, so it started scanning priority 4 folders above the file's folder.  But I am fine dropping priority as long as I can search multiple folders for proximity.

  • What version of ProjectWise Explorer do you have installed on the machine you are running PowerShell on?


    Mark Weisman | Bentley Systems

Reply Children
No Data