When I run this script:
$a = Get-PWFolders -FolderPath 'Projects\123456 - Project'
$b = Get-PWFolders -FolderPath 'Projects\123456 - Project' -JustOne
I get the wrong dates unless I use the -JustOne switch:
Im planning to loop through a few folders, so I cant use the -JustOne switch. Is this a bug?
I found using -Slow will return the correct date but it took over 30min to loop through a single project of 125 folders. This wont be feasible to run on hundreds of projects. Does anyone know if there is a faster way to get the folder dates?
I've not found one.
Brian - I'd like to request that all the Get-PWFolders* and Get-PWDocuments* cmdlets support a -Properties option where you can provide a list of properties you want and it returns just those plus the default set. Get-ADUser (and -ADGroup I believe) supports this.
-Properties * would be the same as -Slow.
From the Get-ADUser help:
Specifies the properties of the output object to retrieve from the server. Use this parameter to retrieve properties that are not included in the
Specify properties for this parameter as a comma-separated list of names. To display all of the attributes that are set on the object, specify *
To specify an individual extended property, use the name of the property. For properties that are not default or extended properties, you must
specify the LDAP display name of the attribute.
To retrieve properties and display them for an object, you can use the Get-* cmdlet associated with the object and pass the output to the Get-Member
cmdlet. The following examples show how to retrieve properties for a group where the Administrator's group is used as the sample group object.
Get-ADGroup -Identity Administrators | Get-Member
To retrieve and display the list of all the properties for an ADGroup object, use the following command:
Get-ADGroup -Identity Administrators -Properties *| Get-Member
The following examples show how to use the Properties parameter to retrieve individual properties as well as the default, extended or complete set
To retrieve the extended properties "OfficePhone" and "Organization" and the default properties of an ADUser object named "SaraDavis", use the
GetADUser -Identity SaraDavis -Properties OfficePhone,Organization
To retrieve the properties with LDAP display names of "otherTelephone" and "otherMobile", in addition to the default properties for the same user,
use the following command:
GetADUser -Identity SaraDavis -Properties otherTelephone, otherMobile |Get-Member
Also, I'd like the the object returned to not include the properties that aren't retrieved (so for example when .ProjectGUID isn't retrieved don't include the property, not return "00000000-0000-0000-0000-000000000000"). Although I expect this might be difficult with the current object definitions.
Oh and FYI, -JustOne always does a -Slow when used since the lookup time for a single record is very fast. I think that's in the help somewhere. it threw me for a loop to initially.
Thanks Kevin. I think that's a good point. There's confusion when some of the properties return null and others return incorrect values.
Hey Kevin, filtering the properties not populated may be a bit difficult as you suspect, however, I will look into it. It's sometimes quicker to use the get-pwfolders to get all of the folder objects you want, and then loop through them and use the get-pwfolders with the -slow switch parameter to gather the data you want. Seems a bit convoluted, but seems to be quicker. For me anyway.