打开管理共享脚本
幸福又遇到脚本问题了,还是我来帮他解决掉吧!
此脚本通过组策略分发。作用:打开客户机的管理共享。
[code]ON ERROR RESUME NEXT
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oreg=GetObject("winmgmts:{impersonationLevel=impersonate}!" &_
strComputer & "rootdefault:StdRegProv")
strKeyPath = "SystemCurrentControlSetServicesLanmanServerParameters"
strValueName = "AutoShareServer"
dwValue = 1
oreg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
strValueName = "AutoShareWks"
dwValue = 1
oreg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
if err = 0 then
Wscript.echo "管理共享已经打开!"
end if
if err <> 0 then
Wscript.echo "脚本失败,操作未能完成!"
Err.Clear
end if[/code]
保存内容为Autoshare.vbs执行即可。
按幸福要求重新更改了脚本,如下:
[code]ON ERROR RESUME NEXT
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oreg=GetObject("winmgmts:{impersonationLevel=impersonate}!" &_
strComputer & "rootdefault:StdRegProv")
strKeyPath1 = "SystemCurrentControlSetServicesLanmanServerParameters"
strKeyPath2 = "SYSTEMControlSet001ControlLsa"
strKeyPath3 = "SYSTEMCurrentControlSetControlLsa"
strValueName = "AutoShareServer"
dwValue = 00000001
oreg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath1,strValueName,dwValue
strValueName = "AutoShareWks"
dwValue = 00000001
oreg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath1,strValueName,dwValue
strValueName = "restrictanonymous"
dwValue = 00000000
oreg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath2,strValueName,dwValue
strValueName = "restrictanonymous"
dwValue = 00000000
oreg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath3,strValueName,dwValue
strValueName = "limitblankpassworduse"
dwValue = 00000000
oreg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath2,strValueName,dwValue
strValueName = "limitblankpassworduse"
dwValue = 00000000
oreg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath3,strValueName,dwValue
Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
objPolicy.FirewallEnabled = FALSE
if err = 0 then
Wscript.echo "管理共享已经打开!"
end if
if err <> 0 then
Wscript.echo "脚本失败,操作未能完成!"
Err.Clear
end if[/code]
参考文章http://www.microsoft.com/technet/community/columns/scripts/sg1104.mspx



太好了,碎片!希望你早点回四川。刻录好光盘,来厦门我请你吃龙虾大餐!
楼主你好,关于楼上的脚本,我已经测试过,有的电脑可以,有的不可以,但如果直接运行注册表。由于本人水平有限,希望楼主帮忙,谢谢!具体内容如下:
打开硬盘各分区的默认共享(原系统本来就是开的).reg
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters]
"AutoShareServer"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters]
"AutoShareWks"=dword:00000001
J另一个REG
开通局域网共享.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa]
"restrictanonymous"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"restrictanonymous"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"limitblankpassworduse"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Lsa]
"limitblankpassworduse"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{75048700-EF1F-11D0-9888-006097DEACF9}\Count]
"HRZR_EHAPCY"=hex:0C,00,00,00,26,00,00,00,F0,FB,E5,52,64,95,C6,01
"HRZR_EHAPCY:"P:\JVAQBJF\flfgrz32\sverjnyy.pcy",Jvaqbjf 防火墙"=hex:0C,00,00,00,08,00,00,00,F0,FB,E5,52,64,95,C6,01
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List]
"445:TCP"="445:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22005"
"137:UDP"="137:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22001"
"138:UDP"="138:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22002"
"139:TCP"="139:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22004"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Epoch]
"Epoch"=dword:000001ED
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Providers]
"LogonTime"=hex:E8,31,8E,4F,64,95,C6,01
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List]
"445:TCP"="445:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22005"
"137:UDP"="137:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22001"
"138:UDP"="138:UDP:LocalSubNet:Enabled:@xpsp2res.dll,-22002"
"139:TCP"="139:TCP:LocalSubNet:Enabled:@xpsp2res.dll,-22004"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Epoch]
"Epoch"=dword:000001ED
;《GhostXP_SP2电脑公司特别版》作者编写。感谢您的使用。
楼主,由于字数限制。分几次发,只要运行两个REG 文件就可以了
如果只打开管理共享,我脚本中所改的两个键值就可以实现了。碎片经测,2000到2003都可以很正常的执行并更改。如果单独手工执行,你要一定要确认自己有更改注册表的权限(administrator),还有就是,碎片并未把防火墙考虑在内,通过组策略大量分发reg文件也不是很好。