Question

Need help with writing a Windows PowerShell script that will perform the following functions: Sea...

Need help with writing 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.

I am new to this so any help on writing the code or where to begin will be helpful.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:
# PowerShell script to list the files with .doc,.docx,.xls extension and write output to text file
#assign your computer path to path variable
$path = C:\windows\system32
$Dir = get-childitem path -recurse
$searchPaths = Get-ChildItem -Path path -Directory
#List variable search for the given extension where * means consider all the files with .doc,... extensions
#Group-Object -Property Directory count the number of files found for each extension
$List = Get-ChildItem -Path $searchPaths -recurse -filter *.doc,*.docx,*,*.xls,*.xlsx | Group-Object -Property Directory
#ouput is written to the File_Summary.txt file
#please change below 'C:\Output\File_Summary.txt' output file path if required
$List |ft fullname |out-file C:\Output\File_Summary.txt

#resources to learn PowerShell Scripting
#good place - https://devblogs.microsoft.com/scripting/weekend-scripter-the-best-ways-to-learn-powershell/
#https://docs.microsoft.com/en-us/powershell/
#http://powershelltutorial.net/
#Best Of Luck

Add a comment
Know the answer?
Add Answer to:
Need help with writing a Windows PowerShell script that will perform the following functions: Sea...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • i need help with this scripting assignment in power shell thanks Lab 7: PowerShell Search and...

    i need help with this scripting assignment in power shell thanks Lab 7: PowerShell Search and Report Search Report host path date Execution time nnn Directories n, nnn, nnn Files nnnnnnn Sym links nnnnnnn Old files nnnnnnn Large files nnnn, nnn Graphics files nnnnnnn Executable files nnnnnnn Temporary files n, nnn, nnn TotalFileSize nnnn, nnn Introduction Lab 7 is nearly identical to Lab 2, except it is written in PowerShell, uses no UNIX/Linux tools to do its work, creates no...

  • Hello, please help with the following, you're tasked with writing a shell script named “rpsm.sh”....

    Hello, please help with the following, you're tasked with writing a shell script named “rpsm.sh”. The script reports and prints (to stdout) selected storage management information. Think of it as “RePort Storage Management”. The easy way to describe what the script needs to do is to look at what it should display in the case where you provide incorrect parameters, or in the case where you provide “-h” for help: Usage: ./rpsm.sh <options>< directory> Reports selected information about specified directory...

  • In notepad 4. Build a document containing the following: a. Place a heading at the top...

    In notepad 4. Build a document containing the following: a. Place a heading at the top center of the document in all capital letters containing: MY BACKGROUND b. In a paragraph containing complete sentences of correctly spelled words, please describe the following about yourself: (1) Where you were born (city, state, country) (2) What brought you to Middlesex County College (3) What you are studying at Middlesex County College (4) What you like to do in your spare time when...

  • Java Description You are given the task of reading a student’s name, semester letter grades, and...

    Java Description You are given the task of reading a student’s name, semester letter grades, and semester hours attempted from one file; calculating the semester GPA; and writing the student’s name and semester GPA to another file. GPA Calculation GPA = Total Quality Points / Hours Attempted Quality Points for each class = Grade Conversion Points * Hours Attempted The letter grades with corresponding point conversions is based upon the following table: Letter Grade Conversion Points A 4 points B...

  • Homework 3: Input Validation 1   Objectives control structures console-based user input using Scanner class writing complete...

    Homework 3: Input Validation 1   Objectives control structures console-based user input using Scanner class writing complete programs using two classes: client and supplier 2   User Interface Specification This is a console-based I/O program. Display should go to System.out (print or println) and the program will get user input using the Scanner class. The flow of execution should be as follows: When the program starts, display a one-line introduction to the user Display a menu with 5 options 1. validate zip...

  • I need help writing this C code. Here is the description: Let's say we have a...

    I need help writing this C code. Here is the description: Let's say we have a program called smart typing which does two things: The first letter of a word is always input manually by a keystroke. When a sequence of n letters has been typed: c1c2...cn and the set of words in the dictionary that start with that sequence also have c1c2...cnc then the smart typing displays c automatically. we would like to know,  for each word in the dictionary,...

  • Hello. I need help writing the following Java Program. Thank you Develop a class encapsulating the...

    Hello. I need help writing the following Java Program. Thank you Develop a class encapsulating the concept of a college course, assuming that a course has following attributers: code (for instance COSC1337), a description, and a number of credits (for instance 3). Include a constructor, the accessors, mutators and methods ‘toString’, ‘equals’, and ‘finalize’. Write a client class to test the behavior of the class and its methods. The outline of the class is given as follows: public class Course...

  • For the following task, I have written code in C and need help in determining the...

    For the following task, I have written code in C and need help in determining the cause(s) of a segmentation fault which occurs when run. **It prints the message on line 47 "printf("Reading the input file and writing data to output file simultaneously..."); then results in a segmentation fault (core dumped) I am using mobaXterm v11.0 (GNU nano 2.0.9) CSV (comma-separated values) is a popular file format to store tabular kind of data. Each record is in a separate line...

  • NEED HELP with HTML with Javascript embedding for form validation project below. I have my code...

    NEED HELP with HTML with Javascript embedding for form validation project below. I have my code below but I'm stuck with validation. If anyone can fix it, I'd really appreciate. ****************************************************************************** CODE: <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Nice</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> var textFromTextArea; function getWords(){ var text =...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT