Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Setup file integrity on a full volume
  2. Get-ChildItem R: -Recurse | select fullname | Set-FileIntegrity -enable $True
  3. # Setup file integrity on a single file
  4. Set-FileIntegrity R:\test -enable $True
  5. # Setup file integrity on a directory
  6. Get-ChildItem R:\test -recurse | select fullname | Set-FileIntegrity -enable $True
  7. # Get file integrity settings for a file
  8. Get-FileIntegrity 'R:\test\diag\localhost\OperationalLog.evtx'
  9. # Repair file integrity for a file (this seems to be broken?)
  10. Repair-FileIntegrity 'R:\test\diag\localhost\OperationalLog.evtx'
  11.  
  12. # Get Various info on a Storage Space Pool
  13. get-volume -driveletter r | get-storagepool
  14. get-volume -driveletter r | get-storagepool | Out-gridview
  15. get-volume -driveletter r | get-storagepool | select friendlyname, isreadonly, name, resiliencysettingnamedefault,size,healthstatus,operationalstatus,repairpolicy
  16. get-volume -driveletter r | Get-VolumeScrubPolicy
  17.  
  18. # Optimize volume (including underlying physical disks)
  19. Optimize-Volume -DriveLetter R -Verbose -Analyze
  20. # Optimize storage pool (this seems like it's a proper scrub...)
  21. get-volume -driveletter r | get-storagepool | Optimize-StoragePool
  22.  
  23. # Volume Corruption stuff
  24. Get-VolumeCorruptionCount r # Doesn't seem to apply to ReFS
  25. repair-volume -driveletter r # Doesn't apply to ReFS
  26. Repair-Volume -DriveLetter R -Scan # Doesn't apply to ReFS
  27.  
  28. # Paw through system event log looking for error messages / warnings
  29. $TempSystemLog = (Get-WinEvent -LogName System)
  30. $TempSystemLog | group { $_.providername } | select name
  31. $TempSystemLog | Where-object {$_.ProviderName -eq "Disk"}
  32. $TempSystemLog | Where-object {$_.ProviderName -eq "Virtual Disk Service"}
  33. $TempSystemLog | Where-object {$_.ProviderName -eq "NTFS"}
  34. $TempSystemLog | Where-object {$_.ProviderName -eq "ReFS"}
  35. $TempSystemLog | Where-object {$_.ProviderName -eq "Microsoft-Windows-Ntfs"}
  36. $TempSystemLog | Where-object {$_.ProviderName -eq "Microsoft-Windows-Refs"}
  37.  
  38. # Get various info on disks in a Storage Space Pool
  39. get-volume -driveletter r | get-storagepool | Get-PhysicalDisk | Get-StorageReliabilityCounter
  40. get-volume -driveletter r | get-storagepool | Get-PhysicalDisk | Get-StorageAdvancedProperty
  41. Get-VirtualDisk -FriendlyName 'Travel' | Get-PhysicalDisk
  42. Get-VirtualDisk -FriendlyName 'Travel' | Get-PhysicalDisk | Enable-StorageMaintenanceMode
  43. Get-VirtualDisk -FriendlyName 'Travel' | Get-PhysicalDisk | Disable-StorageMaintenanceMode
  44. Get-VirtualDisk -FriendlyName 'Travel' | get-storagetier
  45. Get-VirtualDisk -FriendlyName 'Travel' | Get-StorageSubSystem
  46. Get-VirtualDisk -FriendlyName 'Travel' | Get-StorageSubSystem | Get-StorageDiagnosticInfo
  47.  
  48. # Look for unhealthy pools and which disks are 'bad'
  49. $storagePools = Get-StoragePool
  50. foreach($pool in $storagePools){
  51.     if($pool.HealthStatus -ne "Healthy" -and $pool.IsPrimordial -ne "True"){
  52.         $physicalDisks = $pool | Get-PhysicalDisk |
  53.           Select FriendlyName, Manufacturer, Model, SerialNumber, OperationalStatus, HealthStatus, Usage, Size
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement