Hello,
I am fairly new to PS. I have been stealing scripts and many of them are short and I just add the 'export-csv' cmd to them and run them right from a PS prompt. I'm confused about adding the 'export-csv' to a .ps1 - where to add it. I did find some other posts asking something similar and they were instructed to create and array to store the results. I see it and have tried to add but it's not working. Wondering if someone can help.
This is just a simple script to return a list of folders in the dir.
Any assistance is greatly appreciated!
__________________________
# initialize the items variable with the
# contents of a directory
$items = Get-ChildItem -Path "c:\temp"
# enumerate the items array
foreach ($item in $items)
{
# if the item is a directory, then process it.
if ($item.Attributes -eq "Directory")
{
Write-Host $item.Name
}
}