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
$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\")
And
$myPriority = "Folder 1\subfolder\","Folder 2\","Folder 3\"
With no success. What am I missing?
I managed to get this working with the following:
$ScanThese = '{GUID1};{GUID2};{GUID3}'
$myPriority = 'Folder 1\subfolder;r:Folder 2;r:Folder 3'
$NewScanRef = @{DataSourceName = 'myDatasource';UserName = 'myUserName';Password = 'mypassword;ScanMode = 'references;linksets';MasterDocuments = $ScanThese;Priority = $myPriority ;Order = 'priority;proximity';LogFilePath = $logpath ;}New-PWScanForReferences @NewScanRef -RecursePriority
MasterDocuments = $ScanThese;
Priority = $myPriority ;
LogFilePath = $logpath ;
New-PWScanForReferences @NewScanRef -RecursePriority
Replace GUID1 with the actual GUID, retaining the {} around the GUID. Do the same for GUID 2 and GUID 3
Apparently adding the r: to the first folder in the Priority causes a problem. The -RecursePriority is applied to the first folder in the list, but not the subsequent ones. I therefore added the r: in front of the subsequent folders for a recursive search in them. I did not expect this inconsistency, but I believe there are a few things inconsistent with the cmdlet and the executable since I could set the Proximity to r:2 when running the executable from the command line but not via the cmdlet.