Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Powershell - Error trapping, log to file

Avatar of daveTechSearch
daveTechSearchFlag for Canada asked on
Microsoft Legacy OS
9 Comments1 Solution4225 ViewsLast Modified:
I'm just trying to figure out the best way to go about trapping errors for this script...

get-childitem in particular.  

This will tell me if somebody has been given full control vs. modify... and ripped out local administrators on our file servers when performing the specific query.


$ACLfor=read-host "Please specify the user or group to scan for"
$arrayDrives=(read-host "Please enter the drives you wish to scan for ACLs in the form of:  c:\,d:\  ").Split(",")
 
@(forEach ($arrayElement in $arrayDrives)
{
get-childitem  -path $arrayElement -recurse |
where{$_.PSIsContainer} |
get-acl |
?{($_.Access | 
%{$_.IdentityReference}) -contains "$ACLfor"} | Select Path,AccessToString
}) | Export-csv ACL.csv -noTypeInformation -ErrorAction SilentlyContinue 
Open in New Window
ASKER CERTIFIED SOLUTION
Avatar of BSonPosh
BSonPoshFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answers