Disable Drive in Windows

C
Carmadi
PT. SATYA AMARTA PRIMA

Hi team, can we disable drive access in windows, I have tried sending a script like this (reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer /t REG_DWORD /v "NoViewOnDrive" /d 4 /f) via mobicontrol but it doesn't Work.

2 years ago
Windows
ANSWERS
MK
Martin K.
2 years ago

Does it work if you set the registry manually ? 

C
Carmadi
2 years ago

Yes, I tried setting it manually and sending the script using CMD on the device it worked, but I tried sending the script via mobicontrol it didn't work

RC
Raymond Chan Diamond Contributor
2 years ago

The syntax of your script is for Microsoft Windows CMD Command Processor, not MobiControl Windows device agent.  It has to be included in a .bat/.cmd file on the device file system and then referenced in the "send-script" action so that the device agent knows that it has to pass the file to the CMD command processor to execute the script. 

On Windows Modern (Win10/11) device platform, you can also use "send-script" action to send Powershell script.   I haven't done any test, but you can try the following for your case:

$registryPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer"

$Name = "NoViewOnDrive"

$value = "4"

New-ItemProperty -Path $registryPath -Name $name -Value $value `  -PropertyType DWORD -Force | Out-Null

A
AMMOD@SOTI
2 years ago

Hi Carmadi

Thanks for posting on SOTI Pulse, Thanks Raymond for responding to the post, your expertise and willingness to help are greatly appreciated!

Have you had an opportunity to test the suggested solutions by Raymond and has it successfully addressed your query?

As Raymond rightly pointed out, the syntax of your script is designed for the Microsoft Windows CMD Command Processor, not the MobiControl Windows device agent. It needs to be included in a .bat/.cmd file on the device file system and then referenced in the "send-script" action. This ensures that the device agent understands it has to pass the file to the CMD command processor for script execution.

You can use the PowerShell command to disable the drives by choosing send script and then PowerShell script.

You can also try to use this script to disable the access of drives –

To disable access to Drive D in Windows using PowerShell, you can use the following command:

Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\D" -Name "Start" -Value 4

This command modifies the registry entry associated with the specified drive (in this case, Drive D) to disable it. Please be cautious when modifying the registry, and ensure you have the necessary permissions. Additionally, consider backing up your registry before making any changes.

Kind regards,

Technical Support | SOTI Inc. |1.905.624.9828 | support@soti.net | www.soti.net |