Create a Directory Tree with Powershell

I was playing around with PSDrives when I decided to write this script. It recurses through (part of) a PSDrive and shows the items it finds in a simple tree view.
The fun part is that it works on any PSDrive!

  • Show-Tree D:\scripts will show subdirectories and files in a tree;
  • Show-Tree HKCU:\ will show Registry keys and subkeys in a tree;
  • Show-Tree VI:\ will show your VMware Virtual Infrastructure in a tree, if you first create a PSDrive for it.

Here’s how to create a PSDrive for you Virtual Infrastructure:

$root = Get-Folder -NoRecursion
New-PSDrive -Name VI -PSProvider VIMInventory -Root ‘\’ -Location $root

Creating a full tree takes plenty of time, but you can get a branch of the full tree like so: Show-Tree VI:\MYDATACENTER\host\MYFOLDER\MYCLUSTER, where you replace the caps with your own names. Use vm instead of host to show the Virtual Machines and Templates view instead of the Hosts and Clusters view.


# Function that lists the children of a dir
function Show-TreeItems

# Function that indents to a level i
function Indent
$Global:Indent = $null
For ($x=1; $x -le $i; $x++)
$Global:Indent += ” “

$Children = Get-ChildItem $Location | Sort Name
ForEach ($Child in $Children)
Indent $i
“{0}{1}” -f $Indent,$Child
If ($Child.PSIsContainer)
# Recurse through subdir
Show-TreeItems $Child.PSPath


# Actual start of script
$i = 0
Show-TreeItems $BaseDir

judge rules against ncaa on compensationIf it Fake ray bans not possible to align the arguments horizontally, connect them with a line on the paper for clarity.. The journalists that both campaigns agreed upon would usually serve on panels posing questions to the candidates.(In 1992, the commission shifted from a panel of journalists to a single moderator format.). They might even block the domain from their search NFL Jerseys China results. Now, that explains Michael Vick’s life to this point, but now let’s talk about the dogs. Friedkin explains that Hickman was compelled to drive this way because the director “questioned his manhood.” They did take some safety precautions, though: They on the roof of the car so that other drivers would stay away. But it’s really important that you do make the change. Over time, the sulfate build up prevents the ability to recharge the battery. Because your body isn’t used to the endurance needed for many WODs, you may find yourself completely unable to rise from the ground to do a pushup after one round. Coste played with the Philadelphia Phillies, with whom he became very popular from 2006 2009. For Pittsburgh Post Gazette reporter Ed Bouchette, the Steelers have been his “beat” since 1985 and he is the envy of his friends, travelling around America every year. Typically, this process is complete by the time a child turns four years.. In addition to the federal government’s campaign, the administration is seeking collaboration from many different types of organizations in communities, including health care Wholesale Jerseys providers, companies, religious organizations and patient advocates, as well as entities like Enroll America that were created to promote the law. The new film “Concussion” brings cheap ray ban Sunglasses outlet a broader awareness to the issue Cheap NFL Jerseys China of head trauma in football, even for those who play the game. To make Internet access more affordable, he proposes that we continue investing in new technologies, like network extension technology, that make it easier to transmit data signals without increasing the cost. Nothing the Flyers bring to the table worries me or should worry the Caps.. On Christmas, people celebrate the birth of Jesus the central figure of the Christian religion. Detailed analysis revealed that most of the water retained was extracellular and not intracellular. They allowed Dalton to complete 23 of 31 passes for 332 yards, 2 TDs and 0 INTs, for a 132.0 passer rating. Don’t expect 20, you know, Brady TD passes. There should just be two movements: Pop up, throw. The game comes just a week after the NFL agreed to spend about a billion dollars to Fake Oakleys Cheap settle brain injury claims with thousands of former players.