skyfree 发表于 2008-5-11 16:12:55

关闭系统还原的VBS脚本,有哪位仁兄可以帮忙改成AU3吗?

Dim strComputer
Dim objWMIService
Dim colListOfServices
Dim objService
Dim oReg
Dim strKeyPath
Dim strValueName
Dim dwValue


strComputer = "."
'禁用服务-------------------------
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service Where Name = 'srservice'")
For Each objService in colListOfServices
objService.Change , , , , "Disabled"   
Next

'改注册表------------------------
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\WindowsNT\CurrentVersion\SystemRestore"
strValueName = "DisableSR"
dwValue = 00000001
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue

上面是一段VBS的脚本,用于关闭系统还原,有哪位仁兄可以帮忙改成AU3脚本,不胜感激。

[ 本帖最后由 skyfree 于 2008-7-16 10:12 编辑 ]

sanhen 发表于 2008-5-12 00:10:44

_DisabledSrv()

Func _DisabledSrv()

Local $strComputer,$objWMIService,$strWMIObjectID,$objService
                                               
$strComputer = "."

$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")
$strWMIObjectID = 'Win32_Service.Name="srservice"'   
$objService = $objWMIService.Get($strWMIObjectID)
$objService.ChangeStartMode ("Disabled")

RegWrite("HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\SystemRestore","DisableSR","REG_DWORD",Hex(1))

EndFunc

木纳 发表于 2008-5-12 17:49:50

居士牛,wmi解决了

skyfree 发表于 2008-5-13 07:31:30

谢谢了~~~~~~~~~~~~~~~!

skyfree 发表于 2008-5-13 07:32:38

不好意思,再问一下,这个可以清理系统还原生成的还原备份文件么?

sanhen 发表于 2008-5-13 07:43:40

这个脚本功能只是禁止服务和写注册而已。。。
需要其他功能还需手动添加。

skyfree 发表于 2008-5-13 19:35:24

谢谢!~~~~~~~~~~~~~~~~~~~~~~

cjl 发表于 2008-5-13 20:06:00

SP3貌视无效......

gzlin10986 发表于 2009-2-9 00:25:53

原帖由 sanhen 于 2008-5-12 00:10 发表 http://www.autoitx.com/images/common/back.gif
_DisabledSrv()

Func _DisabledSrv()

Local $strComputer,$objWMIService,$strWMIObjectID,$objService
                                               
$strComputer = "."

$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=im ...
启用系统还原怎么写?
好象改为Enabled和注册表为0也不行?
页: [1]
查看完整版本: 关闭系统还原的VBS脚本,有哪位仁兄可以帮忙改成AU3吗?