Guest User

Drive script with power control

a guest
Jan 26th, 2026
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. New-BurntToastNotification -AppLogo "C:\Users\Redacted\Documents\DISM & SFC logs\Resources\spanner.jpg" -Text "Initiating Chkdsk"
  2. if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
  3. Start-Process PowerShell -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
  4. exit;
  5. }
  6.  
  7. . "C:\Users\Redacted\Documents\DISM & SFC logs\Resources\Chkdsk\Chkdsk & Backup Functions.ps1"
  8.  
  9.  
  10. # template ends
  11.  
  12.  
  13.  
  14.  
  15. # Script specifics begin
  16. # Preparatory Steps
  17. Start-UnattendedPowerPlanEnable
  18.  
  19.  
  20.  
  21. # Main Course
  22. $JobType = "Chkdsk"
  23. $OriginDriveLabel = "Master Storage"
  24. Start-ScriptedStart
  25. Start-ChkdskCommand
  26.  
  27.  
  28.  
  29.  
  30. New-BurntToastNotification @LogoSplat -Text "$JobType for $OriginDriveLabel Complete. For logs, see C:\Users\Redacted\Documents\DISM & SFC logs"
  31. Start-Sleep -Seconds 10
  32.  
  33. Start-InstanceCheckandShutdown
  34.  
  35. Stop-Transcript
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment