Question

In: Computer Science

For this assignment, you will need any computer running PowerShell v5 or later. Your answer should...

For this assignment, you will need any computer running PowerShell v5 or later. Your answer should only include the function or the script files that generate the results.

  1. The Get-ChildItem cmdlet is very useful in obtaining files and directory information. Your challenge is to create a PowerShell function that displays all ‘.exe’ and ‘.dll’ files stored under C:\Windows\System32, whose size is more than 5 MB. Group the files based on their extension and store the list into a text file.

Solutions

Expert Solution

solution;

script.ps1
************

$path = "C:\Windows\System32"
$destination = "C:\Users\Administrator\Desktop\output.txt"

$results = Get-ChildItem $path -Recurse | where {$_.extension -in ".dll",".exe"} | Where-Object {$_.length/1MB -gt 5} | Select-Object Name, Extension, @{Name="Mbytes";Expression={ "{0:N0}" -f ($_.Length / 1mb) }}
$results | Sort-Object -Property extension | Out-File $destination
$results|group extension|select Count,Name,@{l='Total MB';e={$_.Group | Measure-Object -Property Mbytes -Sum|select -expand sum}}| Out-File $destination -Append


Related Solutions

For this assignment, you will need any computer running PowerShell v5 or later. Your answer should...
For this assignment, you will need any computer running PowerShell v5 or later. Your answer should only include the function or the script files that generate the results. The Get-ChildItem cmdlet is very useful in obtaining files and directory information. Your challenge is to create a PowerShell function that displays all ‘.exe’ and ‘.dll’ files stored under C:\Windows\System32, whose size is more than 5 MB. Group the files based on their extension and store the list into a text file.
For this assignment, you will need any computer running PowerShell v5 or later. Your answer should...
For this assignment, you will need any computer running PowerShell v5 or later. Your answer should only include the function or the script files that generate the results. For this question, your challenge is to create a PowerShell function that accesses all the log files stored under C:\Windows\System32\winevt\Logs. The function should display only those event logs whose size is more than 1MB. Sort the result by LastWriteTime in descending order.
For this assignment, you will need any computer running PowerShell v5 or later. Your answer should...
For this assignment, you will need any computer running PowerShell v5 or later. Your answer should only include the function or the script files that generate the results. For this question, your challenge is to create a PowerShell function that accesses all the log files stored under C:\Windows\System32\winevt\Logs. The function should display only those event logs whose size is more than 1MB. Sort the result by LastWriteTime in descending order.
The Lab For this assignment, you need access to a computer running Windows 7, Windows 10...
The Lab For this assignment, you need access to a computer running Windows 7, Windows 10 or a current operating system. Create a folder that contains two subfolders and five files of different types. Each subfolder should have at least three files. Apply each of the NTFS standard permissions to the first folder you created, and allow the permissions to be inherited. Record and report the effects of each change.
Assignment- [ A4]:  For this assignment you need to answer all the questions: Every productive activity involves...
Assignment- [ A4]:  For this assignment you need to answer all the questions: Every productive activity involves some combination of different categories of scarce resource. Think of your OWN business proposed to start in 2021. Q1. Which among the following economic system would easily overcome the economic crisis that caused during Covid 19 pandemic?                 a.     Capitalist economy b.     Socialist economy c.     Mixed economy You are required to build and justify three arguments in favor and against of the selected economic system.                             (6+6 Marks) Q2. According...
Use the data below to answer the questions in this assignment. You will first need to...
Use the data below to answer the questions in this assignment. You will first need to enter the following data in SPSS with “age” and “hours” as your variable names. Age and Hours on Computer Data Age (X): 24, 23, 23,25,27, 21,21,30,21,29 Number of hours on spent on computer per week (Y): 14,24,18,23,19,23,16,10,6,15 This question is only being used to describe the data set. In the box below you only need to enter 0. Run a correlation analysis in SPSS...
I need some assistance with the following assignment: Cron is a system daemon running in the...
I need some assistance with the following assignment: Cron is a system daemon running in the background helping you schedule and execute tasks such as system backups. In this lab you will learn how to schedule backups with user and system cron tables. Submit a report that lists the commands that you would use to accomplish the following tasks: Check the status of a cron daemon Stop and terminate a cron daemon Start and run a cron daemon Restart a...
Five years later, you are offered your dream job in Costa Rica. You need to sell...
Five years later, you are offered your dream job in Costa Rica. You need to sell this house in order to purchase a new one where you are moving. Rents have increased since you purchased the home and you estimate that the home will rent for $20,400 per year (net). You have found a high quality tenant willing to sign a five year lease under the following conditions. Rent will be $$20,400 each year for the first three years, and...
Until now, you have had to leave your team management program running on your computer indefinitely...
Until now, you have had to leave your team management program running on your computer indefinitely since you did not want to lose the list of players. Finally, you are ready to add the components to your team management program that will allow you to store the player’s information on your computer’s hard drive, thus, allow you to shut down your program without losing your data. You will need to modify your program to: include a Save option in the...
Should genetic screening or testing be mandatory for any disease? Support your answer.
Should genetic screening or testing be mandatory for any disease? Support your answer.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT