The above function Install-Driver takes one parameter $name, which signifies a driver name that we want to install.
The function Install-Driver will:
Attempt to stop the service (unload the driver) if it's already running (no error checking)
Attempt to delete the service (no error checking)
Copy the driver from the current directory to c:\windows\system32\drivers
Create a service for the driver
Start the service (load the driver)
Below screenshot shows the two steps explained above:
Once the powershell profile is saved, close the powershell console and open it again for the function Install-Driver to become usable.
Loading the Driver
Navigate to the folder that contains the .sys file of the driver you want to install, which in my case is wdm-helloworld.sys in Z:\wdm-helloworld\x64\Debug:
Now, we can install the driver by simply invoking:
Stepping through Source Code
If we have source code for the driver we want to debug, we can load its source code and step through it in WinDBG. Load the source code via the Source > Open Source File and re-load the driver again using Install-Driver function: