Link to home
Create AccountLog in
Avatar of RayT
RayTFlag for United States of America

asked on

Arrays & Loops in PowerShell

How do I modify the following script to use Arrays and Loops?

I would like the search folders to be in an array.  Then I can just loop through the array.

$compareDate = (Get-Date).AddDays(-14)
$temp = Get-ChildItem "c:\vbapps\ASP.NET_Apps\" -Recurse| Where-Object { $_.LastWriteTime -ge $compareDate } | Select FullName
$result = $temp
$temp = Get-ChildItem "c:\vbapps\WinForms_Apps\" -Recurse| Where-Object { $_.LastWriteTime -ge $compareDate } | Select FullName
$result = $temp + $result
$result
SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of RayT

ASKER

Thanks!  That's what I needed.