Let’s say somehow I want to disable the webcam on my laptop. How can I do it? I know that I can just put a tape over the lens to physically block it out. What about the computer ways?
Here is the old fashion way called Device Manager. Right-click the Start menu or press Win + X to bring up the Power Menu and open Device Manager there. Then right-click the Cameras there and choose Disable device.

Now here is the fancy PowerShell way.
First of all, to get the camera device:
Get-PnpDevice -Class Camera

To disable the device, you will need the InstanceID, which you can get fairly easily from the command above. Now run the following command in an elevated PowerShell window.
Disable-PnpDevice -InstanceID (Get-PnpDevice -Class Camera).InstanceID

To enable it again later on,
Enable-PnpDevice -InstanceID (Get-PnpDevice -Class Camera).InstanceID
Because it needs to run via an elevated PowerShell session, it’s hard to run against on remote computers. But you can still do it via Device Manager if you need to. Or, if you want to disable the webcam on a group of computers, you can use Group Policy to help you.
Open Group Policy Editor, navigate to the following,
Computer Configuration > Administrative Templates > Windows Components > Camera
And disable the policy Allow use of Camera there.
I’ve got to admit that not every devices can be disabled/enabled via Group Policy but via PowerShell or Device Manager, you can almost disable or enable any devices installed on the computer.
Here is another useful case.
I had a few Surface Pros’ touch screen acting up bad a while back. It’s acting so bad that the only way I can do is to disable it.
Disable-PnpDevice -InstanceID (Get-PnpDevice -FriendlyName 'Touch Screen').InstanceID
