Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Clear-Host
- Do {
- $num=Read-Host "
- Press 1 for a list of Log Files.
- Press 2 for List of files in folder.
- Press 3 for CPU Processor %, Memory Usage.
- Press 4 for a List of Running Processes.
- Press 5 to Exit"
- # Displays in PS as instructions.
- Switch ($num){
- 1 {Get-ChildItem -path* -Include *.log | out-file -path DailyLog.txt -Append}
- # This generates a .txt file with all the log files in the directory.
- 2 {Get-ChildItem -path* | out-file -path\stuff.txt -Append}
- # This generates a .txt file with all the files in the directory.
- 3 {Get-Counter -Counter "\Processor(_Total)\% Processor Time","\memory\% committed bytes in use" -SampleInterval 5 -MaxSamples 4}
- # Uses counters to list the current CPU % Processor Time and physical memory usage. Collects 4 samples with each sample being a 5 second interval.
- 4 {Get-Process | sort CPU -descending | out-gridview}
- # Lists all the different running processes inside your system. Sorts the output by processor time in seconds greatest to least, and displays it in a grid format
- 5 {Write-Host "Exiting Script"}
- # Exits script.
- }
- }
- Until ($num -eq 5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement