{"id":510,"date":"2009-11-16T11:30:24","date_gmt":"2009-11-16T16:30:24","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=510"},"modified":"2009-11-16T11:39:24","modified_gmt":"2009-11-16T16:39:24","slug":"all-hail-dir-usealot","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/","title":{"rendered":"All Hail Dir UseALot!"},"content":{"rendered":"<p>Some of you know my relationship with the a command prompt goes back a long, long way. Naturally I became very adept at using the DIR command, fully taking advantage of its switches to tease out hidden information or to quickly get just the information I wanted. When PowerShell first came out, I made the transition to the DIR alias without too much difficulty. Although I still found myself wanting to run a command like DIR \/ad\u00a0 (ie list only directories). Yes, you can achieve the same results with the PowerShell cmdlets, but that takes too much typing, especially for something I might want to use on a regular basis. I finally got around to writing a DIR function for PowerShell that better emulates my beloved DIR command from the CMD shell.<!--more--><\/p>\n<p>The function is called Get-FolderItem, although when I load the function I also create aliases pdir and gfi. This is a PowerShell v2 function complete with help and examples.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto\" title=\"captured_Image.png\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png_thumb.png\" border=\"0\" alt=\"captured_Image.png\" width=\"484\" height=\"226\" \/><\/a><\/p>\n<p>Here\u2019s the code listing then I\u2019ll explain a few highlights.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Function Get-FolderItem {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #008000\">#requires -version 2.0<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">&lt;<span style=\"color: #008000\">#<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Synopsis<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    A PowerShell version of the DIR command from the CMD shell that supports sorting and filtering.<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Description<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    The DIR command from the CMD shell has useful parameters to sort output by date, \/od, by size \/os and by<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    name \/on. PowerShell<span style=\"color: #006080\">'s Get-ChildItem needs to pipe output to other cmdlets to achieve the same results. <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    This function offers a shortcut. This function also supports the equivalent of \/b, \/a, and \/q. You may<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    need to pipe the function to other cmdlets like Format-Table or Select-Object to achieve the exact results<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    you want.<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    This function includes a custom format PS1XML file, psdir.FileSystem.Format.ps1xml, that should be stored<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    in your profile folder. When you use the -owner parameter, the custom format file is loaded so that<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    owner information is displayed by default. You can also pipe output to Format-Table or Format-List and<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    get Owner information. The original formatting file is reloaded before the function ends.<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    This function supports -Verbose. Use it to troubleshoot or debug the function.<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Parameter Path<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    Enter a folder path. The default is the current directory.<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Parameter Filter<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    A file filter like *.txt.  The default *.*<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Parameter Order<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    The attribute to sort on. Possible values are d[ate],s[ize],e[xtension] and n[ame], which is the default.<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    Prepend -- before the value, ie --date to sort in reverse order. This parameter has an alias of 'o<span style=\"color: #006080\">'<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Parameter Attribute<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    Get a directory listing based on an attribute such as a[rchive], d[irectory], h[idden], s[system] and<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    r[ead]. Equivalent to \/A. Use -- before a value to return results NOT matching. For example, to find<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    all files without the archive attribute set use -attribute --a. You can also combine attributes, for<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    example -attribute dhr to return only read-only and hidden directories. Using this parameter may still<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    display hidden and system files. For example, if you search for attribute 'a<span style=\"color: #006080\">', any hidden or system<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    files with this attribute will also be displayed.<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Parameter Bare<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    Display full path only. Equivalent to \/B. This parameter cannot be used with any other parameters.<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Parameter Owner<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    Adds the owner of each file or folder.<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    This function includes a custom format PS1XML file, psdir.FileSystem.Format.ps1xml, that should be stored<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    in your $profile folder. When you use the -owner parameter, the custom format file is loaded so that<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    owner information is displayed by default. You can also pipe output to Format-Table or Format-List and<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    get Owner information. The original formatting file is reloaded before the function ends.<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Parameter Recurse<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    Recursively search the path.<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Example<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">PS C:\\&gt; get-folderitem -order date<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Display files in the current directory sorted by date.<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Example<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">PS C:\\&gt; get-folderitem c:\\scripts *.ps1 -order --size -recurse<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Recursively search the scripts the directory for all PowerShell files and display output sorted by size in descending order.<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Example<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">PS C:\\&gt; gfi f:\\files -owner -recurse | Sort Owner | Select Owner,FullName,Length,CreationTime,LastWriteTime<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Search files under F:\\Files and display the full filename, the owner, the file size, when it was created and when<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">it was last modified. The results are sorted by owner.<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Example<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">PS C:\\&gt; get-folderitem f:\\files -recurse -attribute a -bare<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Search F:\\files for all files with an attribute of A and use a bare file listing.<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Inputs<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Accepts strings of folder names<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Outputs<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">File and Folder objects<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Link<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">http:\/\/jdhitsolutions.com\/blog\/<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Link<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Get-ChildItem<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">.Notes<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">NAME:      Get-FolderItem<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">VERSION:   1.0<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">AUTHOR:    Jeffery Hicks  http:\/\/jdhitsolutions.com\/blog<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">LASTEDIT:  11\/16\/2009<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">#&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">[CmdletBinding(DefaultParameterSetName=\"Set1\")]<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">#define the parameters<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Param (<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Position=0,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Mandatory=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ParameterSetName=\"Set1\",<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  HelpMessage=\"Enter a folder path\")]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(ParameterSetName=\"Set2\",Position=0)]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [ValidateScript({<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    if ( (Test-Path $_) -AND ((Get-Item $_).PSProvider.Name -eq \"FileSystem\")) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       $True<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   } else {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      Write-Warning \"Can't find $_ or verify that it is a FileSystem PSDrive.<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   } )]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [String[]]$Path=\".<span style=\"color: #006080\">\",<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ValueFromPipeline=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Position=1,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Mandatory=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ParameterSetName=\"Set1<span style=\"color: #006080\">\",<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  HelpMessage=\"A file <span style=\"color: #0000ff\">filter<\/span> like *.txt<span style=\"color: #006080\">\")] <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(ParameterSetName=\"Set2<span style=\"color: #006080\">\", Position=1)] <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [String]$Filter=\"*.*<span style=\"color: #006080\">\",<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ValueFromPipeline=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Mandatory=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ParameterSetName=\"Set1<span style=\"color: #006080\">\",<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  HelpMessage=\"Sort order. Possible values are date,size,extension and name, which is the <span style=\"color: #0000ff\">default<\/span>.<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Prepend a -- sign before the value, ie --date to sort <span style=\"color: #0000ff\">in<\/span> reverse order.<span style=\"color: #006080\">\")]<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(ParameterSetName=\"Set2<span style=\"color: #006080\">\")] <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Alias(\"o<span style=\"color: #006080\">\")] <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [ValidateSet(\"date<span style=\"color: #006080\">\",\"<\/span>size<span style=\"color: #006080\">\",\"<\/span>extension<span style=\"color: #006080\">\",\"<\/span>name<span style=\"color: #006080\">\",\"<\/span>--date<span style=\"color: #006080\">\",\"<\/span>--size<span style=\"color: #006080\">\",\"<\/span>--extension<span style=\"color: #006080\">\",\"<\/span>--name<span style=\"color: #006080\">\")]<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [string]$Order=\"name<span style=\"color: #006080\">\",<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ValueFromPipeline=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Mandatory=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ParameterSetName=\"Set1<span style=\"color: #006080\">\",<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  HelpMessage=\"Select a file or folder attribute.<span style=\"color: #006080\">\")] <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(ParameterSetName=\"Set2<span style=\"color: #006080\">\")] <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [ValidateScript( { foreach ($a in ($_.ToCharArray())) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">     If (! (\"-darhs<span style=\"color: #006080\">\").contains($a)) {<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Warning \"Valid attributes are d,a,r,h and s.<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">     }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">     else {$True}<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">     }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   })]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [String]$Attribute,<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ValueFromPipeline=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Mandatory=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ParameterSetName=\"Set1<span style=\"color: #006080\">\",<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  HelpMessage=\"Recursively search the path.<span style=\"color: #006080\">\")] <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(ParameterSetName=\"Set2<span style=\"color: #006080\">\")] <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Switch]$Recurse,<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ValueFromPipeline=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Mandatory=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ParameterSetName=\"Set2<span style=\"color: #006080\">\",<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  HelpMessage=\"Select a file or folder attribute.<span style=\"color: #006080\">\")] <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Switch]$Bare,<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ValueFromPipeline=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Mandatory=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ParameterSetName=\"Set1<span style=\"color: #006080\">\",<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  HelpMessage=\"Add the file owner as a new property.<span style=\"color: #006080\">\")] <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Switch]$Owner<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"> )<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"> #Start Main Function Body<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"> Begin {<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose \"Processing BEGIN Script Block<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        #define the path to the custom format file<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        $profileDir=Split-Path $profile<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        $formatfile=\"$profiledir\\pdir.FileSystem.format.ps1xml<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        #check for -- at the beginning of the $order parameter<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        if ($order.substring(0,2) -match \"--<span style=\"color: #006080\">\" ) {<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            Write-Verbose \"descending is True<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            $descending=$True<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        }<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose \"Evaluating $order<span style=\"color: #006080\">\"       <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        #evaluate parameters<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        switch -regex ($Order) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        \"name$<span style=\"color: #006080\">\" {$sort=\"<\/span>name<span style=\"color: #006080\">\";break}<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        \"date$<span style=\"color: #006080\">\" {$sort=\"<\/span>LastWriteTime<span style=\"color: #006080\">\";break}<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        \"size$<span style=\"color: #006080\">\" {$sort=\"<\/span>Length<span style=\"color: #006080\">\";break}<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        \"extension$<span style=\"color: #006080\">\" {$sort=\"<\/span>extension<span style=\"color: #006080\">\";break}<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        default {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            #this warning should never be reached but just in case...<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            Write-Warning \"Invalid value $order <span style=\"color: #0000ff\">for<\/span> Order parameter. Valid choices are date,name,size and extension. Use --value to sort <span style=\"color: #0000ff\">in<\/span> reverse order.<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            $fail=$True<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            return<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        } #end switch<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose \"Sorting on $sort<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose \"Initializing `$data<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        #initialize results variable<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        $data=@()<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Verbose \"Exiting BEGIN <span style=\"color: #0000ff\">script<\/span> block<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">} #end Begin<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Process {<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    #bail if $fail was found, but this should never happen<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    if ($fail) {return}<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        If ($_) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            Write-Verbose \"Assigning pipelined input to `$Path<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            $Path=$_<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        }<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      Write-Verbose \"Getting files $<span style=\"color: #0000ff\">filter<\/span> from root of $path<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      #get files from root directory of $path<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      $data+=Get-ChildItem -Path $path -Filter $Filter -force<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      if ($Recurse) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">         Write-Verbose \"Getting files recursively<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">         $data+= Get-ChildItem $Path -Recurse -Force | where {$_.PSIsContainer} | foreach {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">          Write-Verbose \"Processing $($_.fullname)<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">          Get-ChildItem $_.FullName -filter $Filter -force<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        } #end ForEach<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    Write-Verbose \"Finished gathering files<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">} #end Process<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">End {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    Write-Verbose \"Processing END <span style=\"color: #0000ff\">script<\/span> block<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    #filter and sort as necessary and write final objects to the pipeline<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    #filter by attributes and turn attribute values into a character array<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    if ($Attribute -AND $attribute.StartsWith(\"--<span style=\"color: #006080\">\")) {<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose \"Getting files that match $attribute<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        $modes=$Attribute.Substring(2).ToCharArray()<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        #get the first attribute and filter<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose \"Filtering <span style=\"color: #0000ff\">for<\/span> $($modes[0])<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        $data=$data | where {$_.mode -notmatch $modes[0]}<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        #filter for each additional mode<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        for ($i=1;$i -lt $modes.count;$i++) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            Write-Verbose \"Filtering <span style=\"color: #0000ff\">for<\/span> $($modes[$i])<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            $data=$data | where {$_.mode -notmatch $modes[$i]}<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        }<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    elseif ($Attribute) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Verbose \"Getting files that match $attribute<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       $modes=$Attribute.ToCharArray()<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       #get the first attribute and filter<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Verbose \"Filtering <span style=\"color: #0000ff\">for<\/span> $($modes[0])<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       $data=$data | where {$_.mode -match $modes[0]}<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        #filter for each additional mode<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        for ($i=1;$i -lt $modes.count;$i++) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            Write-Verbose \"Filtering <span style=\"color: #0000ff\">for<\/span> $($modes[$i])<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">            $data=$data | where {$_.mode -match $modes[$i]}<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        }<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        else {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">          Write-Verbose \"Removing system and hidden files since no special attributes were passed.<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">          $data=$data | where {$_.Mode -notmatch \"s<span style=\"color: #006080\">\" -AND $_.mode -notMatch \"<\/span>h<span style=\"color: #006080\">\"}<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        }<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       #sort all results PSParentPath to keep everything grouped by folder<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      If ($descending) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">          Write-Verbose \"Sorting data by $sort <span style=\"color: #0000ff\">in<\/span> descending order<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">          $data = $data | sort -property PSParentPath | sort -property $sort -descending<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      Else {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">          Write-Verbose \"Sorting data by $sort<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">          $data= $data  | sort -property PSParentPath,$sort<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      }<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       #if $bare write out only the full filename<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       if ($Bare) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">         Write-Verbose \"Writing data <span style=\"color: #0000ff\">in<\/span> bare mode<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">         $data | select FullName<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      elseif ($owner) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose \"Writing data with owner information<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose \"Loading custom format File $formatfile<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Update-FormatData -prepend $formatfile -ea \"SilentlyContinue<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        #add owner information<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">         $data | foreach {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">           $_ | Add-Member -MemberType NoteProperty -Name \"Owner<span style=\"color: #006080\">\" -value ((Get-ACL $_.fullname).Owner ) -passthru<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">          }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        #reload original FileSystemFormat<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose \"Reloading $pshome\\filesystem.format.ps1xml<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Update-FormatData -prepend $pshome\\filesystem.format.ps1xml -ea \"SilentlyContinue<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      else {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        #just write the results to the pipeline<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">         Write-Verbose \"Write results to the pipeline<span style=\"color: #006080\">\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">          write $data<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">         }<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">     Write-Verbose \"Finished\"<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"> } <span style=\"color: #008000\">#end END<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">} <span style=\"color: #008000\">#end function<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Set-Alias pdir Get-FolderItem<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Set-Alias gfi Get-FolderItem<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>The function is really a wrapper for <a title=\"Get online help\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113308\" target=\"_blank\">Get-ChildItem<\/a> occasionally combined with <a title=\"Get online help\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113423\" target=\"_blank\">Where-Object<\/a>. It takes a file path as the first parameter, defaulting to the current folder if nothing is specified. The parameter includes a validateScript attribute to verify that you are trying to get a directory listing of a FileSystem PSdrive.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">Param (<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Position=0,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Mandatory=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ParameterSetName=<span style=\"color: #006080\">\"Set1\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  HelpMessage=<span style=\"color: #006080\">\"Enter a folder path\"<\/span>)]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(ParameterSetName=<span style=\"color: #006080\">\"Set2\"<\/span>,Position=0)]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [ValidateScript({<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    <span style=\"color: #0000ff\">if<\/span> ( (Test-Path $_) -AND ((Get-Item $_).PSProvider.Name <span style=\"color: #cc6633\">-eq<\/span> <span style=\"color: #006080\">\"FileSystem\"<\/span>)) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       $True<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   } <span style=\"color: #0000ff\">else<\/span> {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      Write-Warning <span style=\"color: #006080\">\"Can't find $_ or verify that it is a FileSystem PSDrive.\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   } )]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [String[]]$Path=<span style=\"color: #006080\">\".\"<\/span>,<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>The parameter can also take pipelined input, although I rarely use it that way.<\/p>\n<p>Unlike the DIR command, I needed to separate out any filtering like *.txt to a separate parameter. It is positional, but only if you specify a path.<\/p>\n<p><span style=\"font-family: 'Lucida Console'; color: #0000ff;\">PS C:\\&gt; pdir . *.txt <\/span><\/p>\n<p><span style=\"font-family: 'Lucida Console'; color: #0000ff;\"> Directory: C:\\ <\/span><\/p>\n<p><span style=\"font-family: 'Lucida Console'; color: #0000ff;\">Mode\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LastWriteTime\u00a0\u00a0\u00a0\u00a0 Length Name<\/span><\/p>\n<p>----\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -------------\u00a0\u00a0\u00a0\u00a0 ------ ----<\/p>\n<p><span style=\"font-family: 'Lucida Console'; color: #0000ff;\"> <\/span><\/p>\n<p>-a---\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8\/31\/2009\u00a0\u00a0 7:13 AM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 55 computers.txt<\/p>\n<p>-a---\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10\/14\/2009\u00a0\u00a0 8:25 AM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 406 FolderACLScan.txt<\/p>\n<p><span style=\"font-family: 'Lucida Console'; color: #0000ff;\">-a---\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\/8\/2009\u00a0\u00a0 8:29 AM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 nvlog.txt<\/span><\/p>\n<p>You\u2019ll notice the output is what you would expect from Get-ChildItem. The function allows you to sort the output by size, name, date and extension. This is similiar to the \/o parameter from DIR. To sort in reverse order in CMD you would use \/O-d (reverse date order). In my function use \u2013 before the value.<\/p>\n<p><span style=\"font-family: 'Lucida Console'; color: #0000ff;\">PS C:\\&gt; pdir \u2013o \u2013date<\/span><\/p>\n<p>You can use \u2013o by the way because I defined it as an alias.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">[Parameter(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ValueFromPipeline=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Mandatory=$False,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  ParameterSetName=<span style=\"color: #006080\">\"Set1\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  HelpMessage=<span style=\"color: #006080\">\"Sort order. Possible values are date,size,extension and name, which is the default. <\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  Prepend a -- sign before the value, ie --date to sort in reverse order.\")]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Parameter(ParameterSetName=<span style=\"color: #006080\">\"Set2\"<\/span>)]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [Alias(<span style=\"color: #006080\">\"o\"<\/span>)]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [ValidateSet(<span style=\"color: #006080\">\"date\"<\/span>,<span style=\"color: #006080\">\"size\"<\/span>,<span style=\"color: #006080\">\"extension\"<\/span>,<span style=\"color: #006080\">\"name\"<\/span>,<span style=\"color: #006080\">\"--date\"<\/span>,<span style=\"color: #006080\">\"--size\"<\/span>,<span style=\"color: #006080\">\"--extension\"<\/span>,<span style=\"color: #006080\">\"--name\"<\/span>)]<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">  [string]$Order=<span style=\"color: #006080\">\"name\"<\/span>,<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>There is also a ValidateSet attribute to verify the value passed.<\/p>\n<p>The main part of the function uses Get-ChildItem and saves the results to a variable.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #008000\">#get files from root directory of $path<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    $data+=Get-ChildItem -Path $path -Filter $Filter -force<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    <span style=\"color: #0000ff\">if<\/span> ($Recurse) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Verbose <span style=\"color: #006080\">\"Getting files recursively\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       $data+= Get-ChildItem $Path -Recurse -Force | where {$_.PSIsContainer} | <span style=\"color: #0000ff\">foreach<\/span> {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose <span style=\"color: #006080\">\"Processing $($_.fullname)\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Get-ChildItem $_.FullName -<span style=\"color: #0000ff\">filter<\/span> $Filter -force<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      } <span style=\"color: #008000\">#end ForEach<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">    }<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>Once I have the data, then I can apply my filtering and sorting. For example\u00a0 I\u00a0 wanted to be able to filter on file attributes like A, H, or S like the \/A switch in DIR, including the ability to display files that DON\u2019T match and the option to filter on multiple modes like HS. Because I have no way of knowing what combination of modes might be passed or whether I need to find files that don\u2019t match, I split the attribute parameter value into an array and then find files that match (or don\u2019t match) by iterating through the array.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #008000\">#filter by attributes and turn attribute values into a character array<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   <span style=\"color: #0000ff\">if<\/span> ($Attribute -AND $attribute.StartsWith(<span style=\"color: #006080\">\"--\"<\/span>)) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Verbose <span style=\"color: #006080\">\"Getting files that match $attribute\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       $modes=$Attribute.Substring(2).ToCharArray()<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       <span style=\"color: #008000\">#get the first attribute and filter<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Verbose <span style=\"color: #006080\">\"Filtering for $($modes[0])\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       $data=$data | where {$_.mode <span style=\"color: #cc6633\">-notmatch<\/span> $modes[0]}<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       <span style=\"color: #008000\">#filter for each additional mode<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       <span style=\"color: #0000ff\">for<\/span> ($i=1;$i <span style=\"color: #cc6633\">-lt<\/span> $modes.count;$i++) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">           Write-Verbose <span style=\"color: #006080\">\"Filtering for $($modes[$i])\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">           $data=$data | where {$_.mode <span style=\"color: #cc6633\">-notmatch<\/span> $modes[$i]}<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       }<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   <span style=\"color: #0000ff\">elseif<\/span> ($Attribute) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      Write-Verbose <span style=\"color: #006080\">\"Getting files that match $attribute\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      $modes=$Attribute.ToCharArray()<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      <span style=\"color: #008000\">#get the first attribute and filter<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      Write-Verbose <span style=\"color: #006080\">\"Filtering for $($modes[0])\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">      $data=$data | where {$_.mode <span style=\"color: #cc6633\">-match<\/span> $modes[0]}<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       <span style=\"color: #008000\">#filter for each additional mode<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       <span style=\"color: #0000ff\">for<\/span> ($i=1;$i <span style=\"color: #cc6633\">-lt<\/span> $modes.count;$i++) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">           Write-Verbose <span style=\"color: #006080\">\"Filtering for $($modes[$i])\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">           $data=$data | where {$_.mode <span style=\"color: #cc6633\">-match<\/span> $modes[$i]}<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       }<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>The data set is revised each time.\u00a0 If no attributes were passed then I clean up the data set to remove hidden and system files. This makes the output more like the regular DIR and Get-Childitem commands.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #0000ff\">else<\/span> {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">         Write-Verbose <span style=\"color: #006080\">\"Removing system and hidden files since no special attributes were passed.\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">         $data=$data | where {$_.Mode <span style=\"color: #cc6633\">-notmatch<\/span> <span style=\"color: #006080\">\"s\"<\/span> -AND $_.mode -notMatch <span style=\"color: #006080\">\"h\"<\/span>}<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       }<\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>All that is really left is to sort the results by the parent folder, again to make the output more like Get-ChildItem. If a sort value was passed, then data is sorted by that value.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #008000\">#sort all results PSParentPath to keep everything grouped by folder<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   If ($descending) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Verbose <span style=\"color: #006080\">\"Sorting data by $sort in descending order\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       $data = $data | sort -property PSParentPath | sort -property $sort -descending<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   }<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   Else {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Verbose <span style=\"color: #006080\">\"Sorting data by $sort\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       $data= $data  | sort -property PSParentPath,$sort<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   }<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>At this point I can simply write $data to the pipeline. But the CMD DIR has two other parameters I like to use \/bare and \/owner.\u00a0 The former displays the full filename and path and nothing else.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #008000\">#if $bare write out only the full filename<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">     <span style=\"color: #0000ff\">if<\/span> ($Bare) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Verbose <span style=\"color: #006080\">\"Writing data in bare mode\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       $data | select FullName<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">     }<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>The latter is only slightly more involved.\u00a0 I can get the owner information for each file or folder object using <a title=\"Get online help\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113305\" target=\"_blank\">Get-ACL<\/a> and adding a new property with <a title=\"get online help\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113280\" target=\"_blank\">Add-Member<\/a>.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #008000\">#add owner information<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">$data | <span style=\"color: #0000ff\">foreach<\/span> {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">   $_ | Add-Member -MemberType NoteProperty -Name <span style=\"color: #006080\">\"Owner\"<\/span> -value ((Get-ACL $_.fullname).Owner ) -passthru<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">}<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>If I write $data to the pipeline, you woiuldn\u2019t see this information, unless you asked for it:<\/p>\n<p><span style=\"font-family: 'Lucida Console'; color: #0000ff;\">PS C:\\&gt; pdir c:\\files \u2013owner | Sort Owner | select Fullname,Length,Owner<\/span><\/p>\n<p>But that seemed like a lot of extra work and something you\u2019d have to remember to do. My solution was to create a custom format extension for files and folders that automatically would display the Owner. The file pdir.FileSystem.format.ps1xml is expected to be found in your PowerShell profile directory.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #008000\">#define the path to the custom format file<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">$profileDir=Split-Path $profile<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">$formatfile=<span style=\"color: #006080\">\"$profiledir\\pdir.FileSystem.format.ps1xml\"<\/span><\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>This file will temporarily replace the default formatting by prepending with the custom formatting using <a title=\"Get online help\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113420\" target=\"_blank\">Update-FormatData<\/a>.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #0000ff\">elseif<\/span> ($owner) {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose <span style=\"color: #006080\">\"Writing data with owner information\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Write-Verbose <span style=\"color: #006080\">\"Loading custom format File $formatfile\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">        Update-FormatData -prepend $formatfile -ea <span style=\"color: #006080\">\"SilentlyContinue\"<\/span><\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png8_.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto\" title=\"captured_Image.png[8]\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png8_thumb.png\" border=\"0\" alt=\"captured_Image.png[8]\" width=\"480\" height=\"222\" \/><\/a><\/p>\n<p>But don\u2019t worry, the function reloads the originally formatting directives.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 10pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\"><span style=\"color: #008000\">#reload original FileSystemFormat<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Write-Verbose <span style=\"color: #006080\">\"Reloading $pshome\\filesystem.format.ps1xml\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 10pt; overflow: visible; border-style: none; padding: 0px;\">       Update-FormatData -prepend $pshome\\filesystem.format.ps1xml -ea <span style=\"color: #006080\">\"SilentlyContinue\"<\/span><\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>One thing to be aware of is that if pipe owner information to another cmdlet, the original formatting will be used so you are back to needing to specify the Owner information.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png10.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto\" title=\"captured_Image.png[10]\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png10_thumb.png\" border=\"0\" alt=\"captured_Image.png[10]\" width=\"480\" height=\"250\" \/><\/a><\/p>\n<p>After you install the script and PS1XML file, be sure to look at the help examples.<\/p>\n<p>After you download the<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/Get-FolderItem.zip\" target=\"_blank\"> zip file<\/a> with the script and ps1xml files, be sure to look at the README file. Enjoy and as always I hope you'll let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some of you know my relationship with the a command prompt goes back a long, long way. Naturally I became very adept at using the DIR command, fully taking advantage of its switches to tease out hidden information or to quickly get just the information I wanted. When PowerShell first came out, I made the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[72,75,8],"tags":[139,97,32,137,534,140,540,138],"class_list":["post-510","post","type-post","status-publish","format-standard","hentry","category-commandline","category-powershell-v2-0","category-scripting","tag-add-member","tag-filesystem","tag-functions","tag-get-childitem","tag-powershell","tag-ps1xml","tag-scripting","tag-update-formatdate"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>All Hail Dir UseALot! &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"All Hail Dir UseALot! &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Some of you know my relationship with the a command prompt goes back a long, long way. Naturally I became very adept at using the DIR command, fully taking advantage of its switches to tease out hidden information or to quickly get just the information I wanted. When PowerShell first came out, I made the...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2009-11-16T16:30:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2009-11-16T16:39:24+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png_thumb.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"All Hail Dir UseALot!\",\"datePublished\":\"2009-11-16T16:30:24+00:00\",\"dateModified\":\"2009-11-16T16:39:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/\"},\"wordCount\":836,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/11\\\/captured_Image.png_thumb.png\",\"keywords\":[\"Add-Member\",\"FileSystem\",\"functions\",\"Get-ChildItem\",\"PowerShell\",\"ps1xml\",\"Scripting\",\"Update-FormatDate\"],\"articleSection\":[\"CommandLine\",\"PowerShell v2.0\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/\",\"name\":\"All Hail Dir UseALot! &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/11\\\/captured_Image.png_thumb.png\",\"datePublished\":\"2009-11-16T16:30:24+00:00\",\"dateModified\":\"2009-11-16T16:39:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/11\\\/captured_Image.png_thumb.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2009\\\/11\\\/captured_Image.png_thumb.png\",\"width\":\"484\",\"height\":\"226\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/510\\\/all-hail-dir-usealot\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"CommandLine\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/commandline\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"All Hail Dir UseALot!\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"All Hail Dir UseALot! &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/","og_locale":"en_US","og_type":"article","og_title":"All Hail Dir UseALot! &#8226; The Lonely Administrator","og_description":"Some of you know my relationship with the a command prompt goes back a long, long way. Naturally I became very adept at using the DIR command, fully taking advantage of its switches to tease out hidden information or to quickly get just the information I wanted. When PowerShell first came out, I made the...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/","og_site_name":"The Lonely Administrator","article_published_time":"2009-11-16T16:30:24+00:00","article_modified_time":"2009-11-16T16:39:24+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png_thumb.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"All Hail Dir UseALot!","datePublished":"2009-11-16T16:30:24+00:00","dateModified":"2009-11-16T16:39:24+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/"},"wordCount":836,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png_thumb.png","keywords":["Add-Member","FileSystem","functions","Get-ChildItem","PowerShell","ps1xml","Scripting","Update-FormatDate"],"articleSection":["CommandLine","PowerShell v2.0","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/","name":"All Hail Dir UseALot! &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png_thumb.png","datePublished":"2009-11-16T16:30:24+00:00","dateModified":"2009-11-16T16:39:24+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png_thumb.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/captured_Image.png_thumb.png","width":"484","height":"226"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/510\/all-hail-dir-usealot\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"CommandLine","item":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},{"@type":"ListItem","position":2,"name":"All Hail Dir UseALot!"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":579,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/579\/powershell-picasso\/","url_meta":{"origin":510,"position":0},"title":"PowerShell Picasso","author":"Jeffery Hicks","date":"February 23, 2010","format":false,"excerpt":"You have probably heard the story (or legend) about Pablo Picasso and his napkin drawing. A guy goes up to Picasso in a cafe and asks for an autograph or something. Picasso sketches out something in a minute or so. He turns to the guy and says, \u201cThat will be\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"powershell--picasso","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/02\/powershellpicasso_thumb.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1677,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1677\/renaming-files-with-powershell\/","url_meta":{"origin":510,"position":1},"title":"Renaming Files with PowerShell","author":"Jeffery Hicks","date":"October 12, 2011","format":false,"excerpt":"I am not a big fan of file names with spaces. I realize they are easy to read and obviously much more \"natural\", but they are simply a royal pain to deal with, especially when working from a command prompt or PowerShell. So naturally the solution is to rename these\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":475,"url":"https:\/\/jdhitsolutions.com\/blog\/mvp\/475\/pmodem-and-folder-listings\/","url_meta":{"origin":510,"position":2},"title":"PModem and Folder Listings","author":"Jeffery Hicks","date":"November 4, 2009","format":false,"excerpt":"PowerShell MVP Oisin Grehan posted a very promising PowerShell module the other day. He calls it the PModem File Transfer Protocol. It is based on the old bulletin board file transfer protocols of the late 20th century, which I have to admit I fondly remember using. Of course Oisin\u2019s work\u2026","rel":"","context":"In &quot;CommandLine&quot;","block_context":{"text":"CommandLine","link":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2144,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2144\/have-your-output-and-variable-too\/","url_meta":{"origin":510,"position":3},"title":"Have Your Output and Variable Too","author":"Jeffery Hicks","date":"March 29, 2012","format":false,"excerpt":"There's a relatively useful suggestion floating around on Twitter on how to save results of PowerShell command to a variable and see the results at the same time. PS C:\\> ($data=get-process) I'll admit this is a clever technique: you get the results from Get-Process written to the pipeline AND a\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4707,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4707\/a-better-powershell-more\/","url_meta":{"origin":510,"position":4},"title":"A Better PowerShell More","author":"Jeffery Hicks","date":"December 23, 2015","format":false,"excerpt":"In PowerShell, when I have a lot of output, I can use the legacy more.com command to page the results to the screen. Get-Process | more There's not anything inherently wrong with this approach. Although one drawback is that it doesn't work in the PowerShell ISE. For that reason alone\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"More PowerShell Output","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-6.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-6.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-6.png?resize=525%2C300 1.5x"},"classes":[]},{"id":2211,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2211\/powershell-scripting-with-validatepattern\/","url_meta":{"origin":510,"position":5},"title":"PowerShell Scripting with [ValidatePattern]","author":"Jeffery Hicks","date":"April 19, 2012","format":false,"excerpt":"I've been writing about a number of parameters attributes you can include in your PowerShell scripting to validate parameter values. Today I want to cover using a regular expression pattern to validate a parameter value. I'm going to assume you have a rudimentary knowledge of how to use regular expressions\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/squarepattern-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=510"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/510\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}