I have added a new post to my blog stepping through the process of updating document attributes using PowerShell. Please take a look.
I was using this method when updating some attributes when I discovered I could not get the exact search I needed. So I used Select-PWSQL -SQLSelectStatement "SELECT doc.O_DOCGUID,doc.O_ITEMNO,doc....", then for each row used Get-PWDocumentsByGUIDs -DocumentGUIDs $docrow["O_DOCGUID"].ToString() to get the document. I was then able to update the attribute(s) on the document.