Script to hide G: drive from user.
Home › Forums › Scripting › General Scripting › Script to hide G: drive from user.
This topic contains 2 replies, has 2 voices, and was last updated by Rems 12 years, 1 month ago.
-
AuthorPosts
-
October 24, 2007 at 7:05 am #128439
In my previous plea for help, I needed a script to shuffle some mapped drives around. REMS meet that challenge marvelously.
http://forums.petri.com/showthread.php?t=19170
My next course of action was to create a GPO setting to hide the G: drive so curious users aren’t compelled to go exploring and possibly do damage to data. For those who ask “why map the drive then?” Well, my app needs RWM control.
My question now is, can a script be created to hide the G: drive? This comes down to my lack of creativity. I can’t think of how (or don’t know) to do this outside of GPO. Thanks again in advance.
October 24, 2007 at 8:52 am #226574Re: Script to hide G: drive from user.
As far as I know, this is only possible to hide local drive’s
- by GPO: http://www.petri.com/gpdrivesoptions.htm
- by script: create a DWord value “NoDrives” in the registrykey :
[HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer]
(Or.. HKLM Key).
A help for calculating the right value can be found here; http://www.wisdombay.com/hidedrive/index.php
The two things you can give a try to protect a mapped drive letter:
1)
Renaming the drive, this will hide the UNC path:
appDrive = “G:”
sAlias = “” ‘or, you can add here the text “Access denied”CreateObject(“Shell.Application”).NameSpace(appDrive).Self.Name = sAlias[/CODE]
2)
If possible create subfolders in the share.
[LIST=1]
[*]Create a subfolder
[*]Set the NTFS security in the mapped folder to domainUsers DENY-‘List folder content’. But do not! pass this security to subfolders.
[/LIST]
Now you can acces G:subfolder but not G:. So if the users don’t know the existence of the subfolder, they cannot browse G:Rems[CODE]appDrive = “G:”
sAlias = “” ‘or, you can add here the text “Access denied”CreateObject(“Shell.Application”).NameSpace(appDrive).Self.Name = sAlias[/CODE]
2)
If possible create subfolders in the share.- Create a subfolder
- Set the NTFS security in the mapped folder to domainUsers DENY-‘List folder content’. But do not! pass this security to subfolders.
Now you can acces G:subfolder but not G:. So if the users don’t know the existence of the subfolder, they cannot browse G:
Rems
October 24, 2007 at 2:36 pm #226576Re: Script to hide G: drive from user.
It is me again :shock:
I tried the registry thing, added “NoDrives” Dword entry with value 64 to the registrykey:
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurre ntVersionPoliciesExplorer
Then Stopped and started the explorer.exe process.Now the mapped drive G: actually was disappeared But also was drive C: :cry: ???
In my case G: was mapped to a local folder on a drive D:.Code:‘ http://www.wisdombay.com/hidedrive/index.phpSet objShell = Wscript.CreateObject(“Wscript.shell”)
key = “HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer”
sEntry = “NoDrives”
sData = 100 ‘[url=http://www.statman.info/conversions/hexadecimal.html]=dec, eq to hex [B]64[/B][/url]
sVType = “REG_DWORD”
objShell.RegWrite key & “” & sEntry, sData, sVTypeBut if you go for G: in the the brower addressbar it will show everything again.
I would rename the drivename anyway.Rems
UPDATE:
http://forums.petri.com/showthread.php?t=25948.
-
AuthorPosts
You must be logged in to reply to this topic.