SHARE
TWEET

Untitled

a guest Jul 16th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Clear-Host
  2.  
  3. Do {
  4. $num=Read-Host "
  5.  
  6. Press 1 for a list of Log Files.
  7.  
  8. Press 2 for List of files in folder.
  9.  
  10. Press 3 for CPU Processor %, Memory Usage.
  11.  
  12. Press 4 for a List of Running Processes.
  13.  
  14. Press 5 to Exit"
  15. # Displays in PS as instructions.
  16. Switch ($num){
  17. 1 {Get-ChildItem  -path\* -Include *.log | out-file -path\DailyLog.txt -Append}
  18. # This generates a .txt file with all the log files in the directory.
  19. 2 {Get-ChildItem -path\* | out-file -path\contents.txt -Append}
  20. # This generates a .txt file with all the files in the directory.
  21. 3 {Get-Counter -Counter "\Processor(_Total)\% Processor Time","\memory\% committed bytes in use" -SampleInterval 5 -MaxSamples 4}
  22. # Uses counters to list the current CPU % Processor Time and physical memory usage. Collects 4 samples with each sample being a 5 second interval.
  23. 4 {Get-Process | sort CPU -descending | out-gridview}
  24. #  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
  25. 5 {Write-Host "Exiting Script"}
  26. # Exits script.
  27.  
  28.               }
  29.    }
  30. Until ($num -eq 5)
  31. # Pressing 5 kills the Do Command
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top