I am new to Powershell so forgive me!
Shawn
Is that for properties inside an Office document?
Marco
--
*Microsoft MVP - Windows Server - Admin Frameworks
https://mvp.support.microsoft.com/profile/Marco.Shaw
*PowerShell Co-Community Director - http://www.powershellcommunity.org
*Blog - http://marcoshaw.blogspot.com
Is 'Last saved by' equel to 'LastModified' ? If so:
PS > dir c:\foo.txt | select Name,lastWriteTime
You can find any object properties by piping the object to get-member cmdlet:
PS > dir c:\foo.txt | get-member -member property,noteproperty
TypeName: System.IO.FileInfo
Name MemberType
---- ----------
PSChildName NoteProperty
PSDrive NoteProperty
PSIsContainer NoteProperty
PSParentPath NoteProperty
PSPath NoteProperty
PSProvider NoteProperty
Attributes Property
CreationTime Property
CreationTimeUtc Property
Directory Property
DirectoryName Property
Exists Property
Extension Property
FullName Property
IsReadOnly Property
LastAccessTime Property
LastAccessTimeUtc Property
LastWriteTime Property
LastWriteTimeUtc Property
Length Property
Name Property
To see the ALL (*) properties and the values pipe the object to format-list
dir c:\foo.txt | format-list *
---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
S> What powershell command would I use to pull file properties (Last
S> saved by) of all files in a directory?
S>
S> I am new to Powershell so forgive me!
S>
S> Shawn
S>
Shawn
http://support.microsoft.com/kb/224351
---
Shay Levy
Windows PowerShell MVP
blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic
S> Thanks! Can you do this for WHO last modified it?
S>
S> Shawn
S>
S> "Shay Levy [MVP]" wrote:
S>
filter Add-LastModifiedBy {
begin {$wd = new-object -c word.application}
process {
if ($_.extension -match '\.doc[mx]?') {
$doc = $wd.documents.open($_.fullName, $false, $true)
[xml]$ooxml = $doc.wordOpenXML
$nsm = new-object xml.xmlNamespaceManager $ooxml.nameTable
$nsm.addNamespace('cp','http://schemas.openxmlformats.org/package/2006/metadata/core-properties')
$lastModBy = $ooxml.selectSingleNode('//cp:lastModifiedBy', $nsm).'#text'
$doc.close([ref]$false)
add-member noteProperty LastModifiedBy $lastModBy -in $_ -pass
}
}
end {
$wd.quit()
# release resources
rv wd, doc, nsm -ea 0
}
}
ls ~\Documents | Add-LastModifiedBy | ft fullname, lastmodifiedby -a
$docs = ls ~\Documents | Add-LastModifiedBy
$docs | ft fullname, lastmodifiedby -a
--
Kiron