killapp nvNetUtils.exe
call Uninstall
del {sysdir}\drivers\nvnetvfd.sys

Del {sysdir}\drivers\nvmfdx32.sys
DelReg HKLM\System\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\Descriptions\NVIDIA nForce Networking Controller

; Uninstall network management and network utilities
[Uninstall]
Call UninstallNAM
Call UninstallNetDiag

; Remove the co-installer before removing the device silently
delbootquiet {sysdir}\nvconrm.dll

; Delete co-installers. Can't rely on wildcards since these names are not nv-specific
delbootquiet {sysdir}\fdco1.dll
delbootquiet {sysdir}\fdco2.dll
delbootquiet {sysdir}\fdco3.dll
delbootquiet {sysdir}\fdco4.dll
delbootquiet {sysdir}\fdco5.dll
delbootquiet {sysdir}\fdco6.dll
delbootquiet {sysdir}\fdcoXins.dll
delbootquiet {sysdir}\fdco1ins.dll

; echo Checking for Network device
enumregcmd HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\{*},call CheckNVIDIAKeys
CheckPath INFCHECK={windir}\Inf\{InfPath}
if {INFCHECK}=TRUE then call RunDpinst

Set Display Name=Nvidia Network Bus Enumerator 
; Remove any NVIDIA device driver if present
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_008C, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_00DF, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0038, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0057, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0269, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0373, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0389, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_03EF, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_03E6, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0452, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0453, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_054E, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_054F, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0086, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_00E6, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0037, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0056, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0268, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0372, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_03E5, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_03EE, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0450, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0451, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_054C, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_054D, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_07DC, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_07DE, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_07DD, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_07DF, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0760, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0761, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0762, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0763, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0AB0, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0AB1, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0AB2, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE&DEV_0AB3, any
if {LeaveDriverStoreCache}=No then RemoveDevice pci,VEN_10DE, Net

[EnumNetworkKeys]
set MyBaseKey={Current Root Key}\{Current Reg Key}
enumregcmd {MyBaseKey}\{*},call CheckNVIDIAKeys

[CheckNVIDIAKeys]
set DriverDesc=FOOBAR
; echo Current Root Key : {Current Root Key}
GetReg DriverDesc={Current Root Key}\{Current Reg Key}\DriverDesc
if {DriverDesc}%NVIDIA then set NVIDIADriverFound=TRUE
if {DriverDesc}%NVIDIA then if {DriverDesc}%Microsoft then set InBoxDriverFound=TRUE
if {DriverDesc}%NVIDIA then GetReg InfPath={Current Root Key}\{Current Reg Key}\InfPath

[RunDpinst]
if {LeaveDriverStoreCache}=No then SysCallAndWait {sysdir}\dpinst.exe /u {windir}\Inf\{InfPath} /s

[UninstallNAM]
; Uninstall network management
; get the NAM GUID
GetReg NAM_GUID=HKEY_LOCAL_MACHINE\Software\NVIDIA Corporation\nForce\network management\settings\GUID

;also get the UninstallReboot key
GetReg NAMReboot=HKEY_LOCAL_MACHINE\Software\NVIDIA Corporation\nForce\network management\settings\UninstallReboot

if {NAMReboot}=1 then Call TriggerNeedReboot
getreg UninstallCommand={uninstregkey}\InstallShield_{NAM_GUID}\UninstallString
if {UninstallCommand}%.exe then syscallandwait {UninstallCommand} -removeonly /z"noreboot" -s
waitonregdel {uninstregkey}\InstallShield_{NAM_GUID},,10000,12, echo Unable to uninstall NAM
set UninstallCommand

; Also check this regkey for Win64 systems
getreg UninstallCommand=HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{NAM_GUID}\UninstallString
if {UninstallCommand}%.exe then syscallandwait {UninstallCommand} -removeonly /z"noreboot" -s
waitonregdel HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{NAM_GUID},,10000,12, echo Unable to uninstall NAM
set UninstallCommand



[UninstallNetDiag]
; Uninstall network diagnostics
RunOnce {sysdir}\nvnetdiag.nvu
[TriggerNeedReboot]
; Hack to trigger a reboot...borrowed from Display NVU.
Copy {current Script},{sysdir}\deleteme_eth.txt
DelBoot {sysdir}\deleteme_eth.txt
DelBoot {sysdir}\nvnrm.nvu

