[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 510
  • Last Modified:

What is the registry key that need to enable to enable C$

Hi,

What is the registry key that need to enable to enable C$

Regards
Sharath
0
bsharath
Asked:
bsharath
  • 5
  • 4
  • 2
  • +1
1 Solution
 
Farhan KaziSystems EngineerCommented:
Hive: HKEY_LOCAL_MACHINE
Key: SYSTEM\CurrentControlSet\Services\LanManServer\Parameters
Name: AutoShareServer
Data Type: REG_DWORD
Value: 1

Have a look at following
http://www.petri.co.il/disable_administrative_shares.htm
0
 
bsharathAuthor Commented:
Will this enable all the default shares?
If i need to disable all default shares and enable C$ alone how do i do it.
0
 
DarylxCommented:
The registry key "AutoShareServer" will disable all default admin shares if the value is set to 0.  If the value is set to 1, the shares will be created when the system boots up.

To disable all default admin shares except C$, you'd have to do it manually.  Use computer management to manually remove the shares you don't want.  Then go into the registry and see if the AutoShareServer or AutoShareWorkstation keys are there.  If they're there, delete them.  Then they won't be able to recreate the shares you removed (if the value is 1) or remove the C$ share (if the value is 0).
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
bsharathAuthor Commented:
I tried this never worked.Any other option to disable all default drive  except the c$ share.
Any way to do this on many machines
0
 
canaliCommented:
: ================
:: READ THIS FIRST
:: ================
:: * To run this script you must have domain administrators rights.
:: * leave the registry key "AutoShareServer" to 1
:: *
:: * Successful run will generate "delshare.log" on C: drive root.
:: * Copy and Paste following script into notepad and save it with name delsADMhare.cmd
:: * after the file is saved in c:\
:: * from command prompt run the following command to schedule delsADMhare.cmd
:: schtasks /create /tn "delADMshare" /tr "c:\delADMshare.cmd"  /ru system /sc onstart
:: * (This script require to be scheduled on system start)
:: * reboot the pc
:: *
:: Batch Script Start
set /a T=0
echo %date% *** %time%     >  c:\delhare.log  2>&1
::wait the service is started
:_LOOP
set /a T=%T%+1
:: *** wait max 60 seconds
if %T% GTR 90 echo error & exit
(sc query lanmanserver|find /i "running" >> c:\delhare.log  2>&1)|| goto :_LOOP
echo service started at %time%     >>  c:\delhare.log  2>&1
 ping -n 2 127.0.0.1 2>&1
:: *** Delete all Admin share except c$ an IPC$
 wmic /OUTPUT:%0\..\delhare.log  share where(not name='c$' and not name='ipc$') delete  
:: Batch end here
0
 
DarylxCommented:
Great answer!
0
 
bsharathAuthor Commented:
Canali will this enable all shares or just C$ ?
0
 
canaliCommented:

http://www.petri.co.il/disable_administrative_shares.htm
this is some lines from Petri site to enable admin shaeres
Servers
For NT 4.0/W2K/Windows Server 2003s, the change is:
Hive: HKEY_LOCAL_MACHINE
Key: SYSTEM\CurrentControlSet\Services\LanManServer\Parameters
Name: AutoShareServer
Data Type: REG_DWORD
Value: 1
Idiot proof note: If you can't find the value in the registry under the exact location (i.e. it does not exist) - please right click in the right pane of the window and create it.
Note: A reboot is necessary for this to take effect.
Workstations
For NT 4.0 Workstation/W2K Pro/XP Pro, the change is:
Hive: HKEY_LOCAL_MACHINE
Key: SYSTEM\CurrentControlSet\Services\LanManServer\Parameters
Name: AutoShareWks
Data Type: REG_DWORD
Value: 1

then my script remove all admin share except c$. But removing admin shares is not a good idea....
0
 
bsharathAuthor Commented:
Canali thanks can you change the script a bit.I want to remove all shared drive share not admin $,IPC$ etc.

Say i have
C$
D$
E$
F$
I want to remove the all these drive$ except c$ and should not come back after restart
0
 
canaliCommented:
ok
: ================
:: READ THIS FIRST
:: ================
:: * To run this script you must have domain administrators rights.
:: * leave the registry key "AutoShareServer" to 1
:: *  this script remove the c$ d$ e$ f$ shares
:: * Successful run will generate "delshare.log" on C: drive root.
:: * Copy and Paste following script into notepad and save it with name delsADMhare.cmd
:: * after the file is saved in c:\
:: * from command prompt run the following command to schedule delsADMhare.cmd
:: schtasks /create /tn "delADMshare" /tr "c:\delADMshare.cmd"  /ru system /sc onstart
:: * (This script require to be scheduled on system start)
:: * reboot the pc
:: *
:: Batch Script Start
set /a T=0
echo %date% *** %time%     >  c:\delhare.log  2>&1
::wait the service is started
:_LOOP
set /a T=%T%+1
:: *** wait max 60 seconds
if %T% GTR 90 echo error & exit
(sc query lanmanserver|find /i "running" >> c:\delhare.log  2>&1)|| goto :_LOOP
echo service started at %time%     >>  c:\delhare.log  2>&1
 ping -n 2 127.0.0.1 2>&1
:: *** Delete all Admin share except c$ an IPC$
 wmic /OUTPUT:c:\delhare.log  share where(name='C$' or name='D$' or name='E$' or name='F$' ) delete  
:: Batch end here
0
 
bsharathAuthor Commented:
Canali thanks.Once more wanted to confirm what this does.Disables all Default shares except c$?
On restart the schedule will run and delete the shares.Am i correct.
0
 
canaliCommented:
NO!
:: ================
:: this script remove the  D$ E$ F$ shares EXCEPT C$
:: READ THIS FIRST
:: ================
:: * To run this script you must have domain administrators rights.
:: * leave the registry key "AutoShareServer" to 1
:: *  this script remove the  D$ E$ F$ shares EXCEPT C$
:: * Successful run will generate "delshare.log" on C: drive root.
:: * Copy and Paste following script into notepad and save it with name delsADMhare.cmd
:: * after the file is saved in c:\
:: * from command prompt run the following command to schedule delsADMhare.cmd
:: schtasks /create /tn "delADMshare" /tr "c:\delADMshare.cmd"  /ru system /sc onstart
:: * (This script require to be scheduled on system start)
:: * reboot the pc
:: *
:: Batch Script Start
set /a T=0
echo %date% *** %time%     >  c:\delhare.log  2>&1
::wait the service is started
:_LOOP
set /a T=%T%+1
:: *** wait max 60 seconds
if %T% GTR 90 echo error & exit
(sc query lanmanserver|find /i "running" >> c:\delhare.log  2>&1)|| goto :_LOOP
echo service started at %time%     >>  c:\delhare.log  2>&1
 ping -n 2 127.0.0.1 2>&1
:: *** Delete all Admin share except c$ an IPC$
 wmic /OUTPUT:c:\delhare.log  share where(name='D$' or name='E$' or name='F$' ) delete  
:: Batch end here

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now