Scripting is a powerful aid to system administrators and, if understood properly
ID: 3670139 • Letter: S
Question
Scripting is a powerful aid to system administrators and, if understood properly, to end users as well. Your group has been asked to provide information about file storage needs on all the computers in the network. Your tool of choice for this task is Windows PowerShell.
For this project, do the following:
Download and install Windows PowerShell if it is not already installed on your computer (see Start Menu > Accessories).
Review the Getting Started information in the Windows PowerShell help file, and study the information in the help file and online resource for basic scripting techniques using Windows PowerShell.
Prepare a document to submit your work:
Use Microsoft Word
Write a Windows PowerShell script that will perform the following functions:
Search your computer for files ending with a .doc, .docx, .xls, or .xlsx file extension.
Output the filenames and sizes (in groups by file extension) to a text file named “File_Summary.txt”. The output should also conclude with a total of the number of files and total file size for each file extension.
Include comments in the script code to document the functionality of the script.
Paste the script and the file output to your MS Word document.
Explanation / Answer
Script :
$Check_Folder = "D:Sam"
$Report_Generate = "E: eport.txt"
$filesReceived = Get-Childitem -Path $Check_Folder -Include *doc, *docx, *xls, *xlsx -Recurse
$filesReceived | Out-File $Report_Generate
$totalfilesReceived = ($filesReceived | Measure-Object).Count
$totalsizeReceived = ($filesReceived | Measure-Object -Sum Length).Sum
write-host "totalfiles: $totalfilesReceived"
write-host "totalsize: $totalsizeReceived"
NOTE : CHANGE THE Check_Folder location to any folder in your System and run the script. It will give the resultant txt file.
OUTPUT File :
Directory: D:SamCampus Connect ProjectKNOWLEDGEuildwebdocs
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 5/16/2013 8:13 PM 4701430 SAYAN.docx
Directory: D:SamCampus Connect Project
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 5/17/2013 9:45 AM 25744 dfd.docx
-a--- 5/17/2013 12:02 AM 65559 INTRODUCTION.docx
Directory: D:SamE DriveInfosys Aptitude
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 9/19/2012 9:42 AM 20941 (www.entrance-exam.net)-Infosys Question Paper 1.docx
-a--- 9/19/2012 9:42 AM 21475 (www.entrance-exam.net)-Infosys Question Paper 2.docx
-a--- 9/19/2012 9:42 AM 21995 (www.entrance-exam.net)-Infosys Question Paper 3.docx
-a--- 9/19/2012 9:42 AM 19201 (www.entrance-exam.net)-Infosys Question Paper 4.docx
-a--- 9/19/2012 9:43 AM 13187 (www.entrance-exam.net)-Infosys Question Paper 5.docx
-a--- 9/19/2012 9:43 AM 13069 (www.entrance-exam.net)-Infosys Question Paper 6.docx
-a--- 9/19/2012 9:43 AM 19968 (www.entrance-exam.net)-Infosys paper 11th September 2005 Mumbai.doc
-a--- 9/19/2012 9:43 AM 15019 (www.entrance-exam.net)-Infosys Placement Paper 2012.docx
-a--- 9/19/2012 9:44 AM 48640 (www.entrance-exam.net)-Infosys Placement Paper III 2010.doc
-a--- 9/19/2012 9:43 AM 14909 (www.entrance-exam.net)-Infosys Placement Paper IV.docx
Directory: D:SamE DriveWipro AptiGEN. APP
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 9/4/2011 10:48 PM 39424 1.doc
-a--- 9/4/2011 2:12 PM 36864 10.doc
-a--- 9/9/2011 3:19 AM 37888 11.doc
-a--- 9/9/2011 3:19 AM 61440 12.doc
-a--- 9/4/2011 10:19 PM 37376 13.doc
-a--- 9/4/2011 10:59 PM 36864 14.doc
-a--- 9/4/2011 10:59 PM 52736 15.doc
-a--- 9/4/2011 10:51 PM 35840 16.doc
-a--- 9/9/2011 3:21 AM 46080 17.doc
-a--- 9/9/2011 3:21 AM 41984 18.doc
-a--- 9/9/2011 3:21 AM 37888 19.doc
-a--- 9/4/2011 9:17 PM 55808 2.doc
-a--- 9/4/2011 11:10 PM 43520 20.doc
-a--- 9/4/2011 11:10 PM 44544 21.doc
-a--- 9/4/2011 11:10 PM 65536 22.doc
-a--- 9/4/2011 10:41 PM 50688 23.doc
-a--- 9/4/2011 10:41 PM 59904 24.doc
-a--- 9/4/2011 9:12 PM 30720 25.doc
-a--- 9/4/2011 10:58 PM 38912 26.doc
-a--- 9/4/2011 10:58 PM 35840 27.doc
-a--- 9/9/2011 3:24 AM 42496 28.doc
-a--- 9/9/2011 3:24 AM 43008 29.doc
-a--- 9/4/2011 9:57 PM 56832 3.doc
-a--- 9/4/2011 9:17 PM 33280 30.doc
-a--- 9/4/2011 10:40 PM 32256 31.doc
-a--- 9/4/2011 10:40 PM 38400 32.doc
-a--- 9/4/2011 10:40 PM 65024 33.doc
-a--- 9/4/2011 9:24 PM 36864 34.doc
-a--- 9/4/2011 9:24 PM 41472 35.doc
-a--- 9/9/2011 3:25 AM 43008 36.doc
-a--- 9/9/2011 3:25 AM 55808 37.doc
-a--- 9/4/2011 10:16 PM 38912 38.doc
-a--- 9/4/2011 10:16 PM 162 39.doc
-a--- 9/4/2011 10:16 PM 32256 4.doc
-a--- 9/4/2011 10:16 PM 37376 40.doc
-a--- 9/4/2011 11:44 AM 44032 41.doc
-a--- 9/4/2011 10:59 PM 44544 42.doc
-a--- 9/4/2011 10:59 PM 32768 43.doc
-a--- 9/9/2011 3:22 AM 32256 44.doc
-a--- 9/9/2011 3:22 AM 35840 45.doc
-a--- 9/9/2011 3:22 AM 30720 46.doc
-a--- 9/4/2011 9:29 PM 35840 47.doc
-a--- 9/4/2011 10:43 PM 39424 48.doc
-a--- 9/4/2011 10:43 PM 38912 49.doc
-a--- 9/4/2011 9:13 PM 40448 5.doc
-a--- 9/4/2011 9:13 PM 37888 6.doc
-a--- 9/4/2011 2:19 PM 43008 7.doc
-a--- 9/4/2011 2:19 PM 39936 8.doc
-a--- 9/4/2011 9:14 PM 53760 9.doc
Directory: D:SamE DriveWipro Apti
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 9/4/2011 9:22 PM 18227 dbms.docx
-a--- 9/4/2011 1:34 PM 24433 networking interview qstn.docx
-a--- 9/30/2012 2:17 PM 11539 Wipro placement Paper Pattern.docx
Directory: D:SamE Drive
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 10/14/2012 6:02 PM 219136 Sandeep_Kumar_Resume_without Sign.doc
Directory: D:SamHospital_Management_Project
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 5/16/2013 12:15 PM 28160 CERTIFICATE_sanatan.doc
-a--- 5/16/2013 12:14 PM 28160 CERTIFICATE_sandeep.doc
Directory: D:SamIMPORTANT Documents
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 6/6/2013 9:30 PM 36351 Sandeep sal.docx
Directory: D:SamMU Sigma Apti paper
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 11/1/2012 10:29 PM 31232 MU Sigma Placement Papers.doc
Directory: D:SamProject
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 5/16/2013 11:53 AM 11383 ACKNOWLEDGEMENT.docx
-a--- 11/28/2012 8:17 PM 131048 Animal Voice Recognition.docx
-a--- 5/16/2013 12:22 PM 28160 CERTIFICATE_arunima.doc
-a--- 5/16/2013 12:24 PM 28160 CERTIFICATE_pawan.doc
-a--- 5/16/2013 12:18 PM 28160 CERTIFICATE_sanatan.doc
-a--- 5/16/2013 12:19 PM 28160 CERTIFICATE_sandeep.doc
-a--- 5/12/2013 11:39 PM 188156 Final Documentation.docx
-a--- 5/16/2013 11:56 AM 11376 Index.docx
Directory: D:Sam
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 10/30/2014 8:42 PM 12970 Sales Book.xlsx
-a--- 11/22/2013 8:37 PM 10928 Sandeep_Kumar_Cover_Letter.docx
-a--- 7/29/2013 8:34 PM 223232 Sandeep_Kumar_CV.doc
-a--- 7/31/2013 10:58 PM 49920 Sandeep_Kumar_CV.docx
-a--- 10/30/2015 8:15 PM 86016 Sandeep_Kumar_CV_Acc.doc
-a--- 10/11/2015 11:34 PM 84992 Sandeep_Kumar_CV_Acc_j.doc
-a--- 11/21/2013 7:09 PM 230400 Sandeep_Kumar_CV_IT.doc
-a--- 6/15/2015 12:10 AM 51581 Sandeep_Kumar_CV_IT.docx
-a--- 10/23/2012 9:52 AM 228864 Sandeep_Kumar_CV_with Sign.doc
-a--- 9/22/2013 3:50 PM 50704 Sandeep_Kumar_CV_WorkEx.docx
-a--- 11/27/2014 8:50 PM 103424 Sandeep_Kumar_CV_WorkEx_IT.doc
-a--- 11/2/2012 10:39 PM 41253 san_cv.docx
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.