Scripts/UpdateAttributes.ps1
#Updates the attributes of all the documents in the specified folder path the @{Name1 = "Value1", Name2 = "Value2"} syntax is called a hash table Import-Module -Name pwps_dab Open-PWConnection -DatasourceName DurhamAlias:NewSource -UserName pwadmin -Password pwadmin -Admin Get-PWDocumentsBySearch -FolderPath 'Import Test PowerShell\Import Test' | Update-PWDocumentAttributes -Attributes @{Title = "100 My new title"; Dwg_no = "00007"; SomeNumber = "555" } Get-PWDocumentsBySearch -FolderPath 'Import Test PowerShell\Import Test' | Remove-PWDocumentVersions-NumberOfVersionsToKeep 3 $documents = Get-PWDocumentsBySearch -FolderPath 'Import Test PowerShell\Import Test\Seed' -GetAttributes foreach ($document in $documents) { if ($document.AttributeRecordCount) { Write-Host $document.AttributeRecordCount, $document.Name, $document.Attributes[0]['Title'] } else { Write-Host $document.AttributeRecordCount, $document.Name, 'No Title' } } |