Hi,
like Linux rmmod Windows can also unload a device driver “online”.
In later Windows release the command devcon.exe from the Windows Device Driver Kit was used for such tasks.
Newer Windows versions have the pnputil.exe command line tool.
An example: Windows PE is running and you want to remove a disk attached from SAN. The Host Bus Adapter is an emulex.
Find all instances
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | X:\> pnputil /enum-devicesInstance ID: PCI\VEN_10DF&DEV_F100&SUBSYS_F10010DF&REV_03\4&1d78c88&0&0010Device Description: Emulex LightPulse HBA - Storport Miniport DriverClass Name: SCSIAdapterClass GUID: {4d36e97b-e325-11ce-bfc1-08002be10318}Manufacturer Name: EmulexStatus: StartedDriver Name: elxstor.infInstance ID: PCI\VEN_10DF&DEV_F100&SUBSYS_F10010DF&REV_03\4&1d78c88&0&0110Device Description: Emulex LightPulse HBA - Storport Miniport DriverClass Name: SCSIAdapterClass GUID: {4d36e97b-e325-11ce-bfc1-08002be10318}Manufacturer Name: EmulexStatus: DisabledDriver Name: elxstor.inf |
And disable the driver
1 2 3 4 5 6 7 8 9 10 | X:\> pnputil /disable-device "PCI\VEN_10DF&DEV_F100&SUBSYS_F10010DF&REV_03\4&1d78c88&0&0010"Microsoft PnP UtilityDisabling device: PCI\VEN_10DF&DEV_F100&SUBSYS_F10010DF&REV_03\4&1d78c88&0&0010Device disabled successfullyX:\> pnputil /disable-device "PCI\VEN_10DF&DEV_F100&SUBSYS_F10010DF&REV_03\4&1d78c88&0&0110"Microsoft PnP UtilityDisabling device: PCI\VEN_10DF&DEV_F100&SUBSYS_F10010DF&REV_03\4&1d78c88&0&0110Device disabled successfully |
The (disk) device could also removed temporarily. For example to get a new diskpart disk number.
In this example a Disk handled by a MegaRaid SR driver.
1 | X:\> pnputil /remove-device "SCSI\Disk&Ven_LSI&Prod_MegaSR__\4&12c2d723&0&020000" |
Then rescan for disks
1 2 | X:\> diskpartDISKPART> rescan |
Michael