Here's a PowerShell script that resets Windows drivers after moving a hard drive to new hardware. It forces Windows to detect and install the correct drivers by removing non-present devices and resetting the Plug and Play (PnP) configuration.
How It Works:
-
Removes Non-Present Devices – Uninstalls ghost devices from the previous hardware.
-
Rescans for Devices – Forces Windows to detect new hardware and install appropriate drivers.
-
Refreshes Device Manager – Ensures immediate application of changes.
-
Restart Prompt – Gives the user an option to restart for a full reset.
Run the script as an Administrator after moving the hard drive to new hardware.