Skip to content

Instantly share code, notes, and snippets.

@bill-long
Created December 28, 2023 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bill-long/54556aa7920fb4164a8a02ec5d84a724 to your computer and use it in GitHub Desktop.
Save bill-long/54556aa7920fb4164a8a02ec5d84a724 to your computer and use it in GitHub Desktop.
# Useful for doing MCDB stuff in a lab
$action = New-ScheduledTaskAction -Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument '-Command "Get-PhysicalDisk | Set-PhysicalDisk -MediaType SSD"'
$trigger = New-ScheduledTaskTrigger -AtStartup
$principal = New-ScheduledTaskPrincipal -UserID "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest
Register-ScheduledTask -TaskName "Set Media Type" -Action $action -Trigger $trigger -Principal $principal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment