Dim SS
Dim S
Dim szMsg
Dim szTtl
Dim l
Dim bFlg
Dim bFlg
Set SS = GetObject("winmgmts:{impersonationLevel=impersonate}"
szMsg = "执行了下列操作:" & vbCrLf
szTtl =
"管理服务程序"
l = Len(szMsg)
For Each S In SS
Select Case UCase(Trim(S.Name))
Case "DFS"
Call StopManual()
Case "ERSVC"
Call StopManual()
Case "HELPSVC"
Call StopManual()
Case "MDM"
Call StopManual()
Case "MESSENGER"
Call StopDisable()
Case "SPOOLER"
Call PrintSpooler()
Case "REMOTEREGISTRY"
Call StopDisable()
Case "SCHEDULE"
Call StopManual()
Case "THEMES"
Call Themes()
Case "AUDIOSRV"
Call WindowsAudio()
Case "W32TIME"
Call StopManual()
End Select
Next
Set
SS = Nothing
Set
S = Nothing
If
Len(szMsg) = l Then szMsg = "您的服务设置和本程序预期的一样!"
MsgBox szMsg, 4160, szTtl
'Distributed File System
'Error Reporting Service
'Help And Support
'Machine Debug Manager
'Task Scheduler
'Windows Time
Sub StopManual()
bFlg =
False
If
StrComp(S.StartMode, "Manual", 1) Then
S.ChangeStartMode("Manual")
bFlg =
True
End If
If
StrComp(S.State, "Stopped", 1) Then
S.StopService
bFlg =
True
End If
If
bFlg Then szMsg = szMsg & vbCrLf & "停止" & S.Caption & "服务,并将其启动类型设为手动。"
'Messenger
'Remote Registry
Sub StopDisable()
bFlg =
False
If
StrComp(S.StartMode, "Disabled", 1) Then
S.ChangeStartMode("Disabled")
bFlg =
True
End If
If
StrComp(S.State, "Stopped", 1) Then
S.StopService
bFlg =
True
End If
If
bFlg Then szMsg = szMsg & vbCrLf & "停止并禁用了" & S.Caption & "服务。"
'Print Spooler
Sub PrintSpooler()
If StrComp(S.State, "Stopped", 1) Or StrComp(S.StartMode, "Manual", 1) Then
If
MsgBox("您是否有打印机?", 4132, szTtl) = 7 Then
S.ChangeStartMode("Manual")
S.StopService
szMsg = szMsg & vbCrLf &
"停止并禁用了" & S.Caption & "服务。"
End If
End If
'Themes
Sub Themes()
If StrComp(S.State, "Stopped", 1) Or StrComp(S.StartMode, "Manual", 1) Then
If
MsgBox("您是否要使用 XP 主题风格?", 4132, szTtl) = 7 Then
S.ChangeStartMode("Manual")
S.StopService
szMsg = szMsg & vbCrLf &
"停止并禁用了" & S.Caption & "服务。"
End If
End If
'Windows Audio
Sub WindowsAudio()
If StrComp(S.State, "Running", 1) Or StrComp(S.StartMode, "Auto", 1) Then
S.ChangeStartMode("Automatic")
S.StartService
szMsg = szMsg & vbCrLf &
"自动启用了" & S.Name & "服务。"
End If


 
目前有0条回应
Comment
Trackback
你目前的身份是游客,请输入昵称和电邮!