c:
del output.txt
type t3.txt | out-file -Append output.txt
date | out-file -Append output.txt
type t1.txt | out-file -Append output.txt
Get-ChildItem C:\ -recurse -include *.mp3,*.wma,*.wmv,*.mov,*.mpg,*.ogg |
sort length -descending | out-file -Append output.txt
type t2.txt | out-file -Append output.txt
Get-ChildItem C:\ -recurse | Sort-Object length -descending | select -first
20 | out-file -Append output.txt
mail -smtpHost smtphub.choicepoint.net -PortNumber 25 -From he...@ada.com -To
jas...@charlesjones.com -Subject "test" -Body "Attached is listing of the top
20 largest files on server and all media" -AttachmentPaths C:\output.txt
It works fine on my local machine where I am Admin, but the remote server
has some protected directories. When I run it there I get the following error:
Get-ChildItem : Access to the path c:\asd is denied.
When this happens the script stops. How do I get the GetChildren to ignore
all errors and still continue with the opertion? I would use the -exclude
option but there are 50+ protected folders.
-erroraction continue
see help about_commonparameters
you could also try using the -force parameter of get-childitem
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk