2009年12月6日日曜日

VB.NET Check Tool



Public Class Form1
Dim regget(10) As String
Dim strComputer = "."
Dim objWMIService = GetObject("winmgmts:\\" & strComputer)
Dim colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
Dim WinDefend = objWMIService.Get("Win32_Service.Name='WinDefend'")
Dim MpsSvc = objWMIService.Get("Win32_Service.Name='MpsSvc'")
Dim Themes = objWMIService.Get("Win32_Service.Name='Themes'")
Dim AudioSrv = objWMIService.Get("Win32_Service.Name='AudioSrv'")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Text = "Check Tool"
Button1.Text = "RegisteredOwner"
Button2.Text = "RegisteredOrganization"
Button3.Text = "Folder Option Settings"
Button4.Text = "AutoPlay"
Button5.Text = "User Account Control"
Button6.Text = "ComputerName"
Button7.Text = "ComputerWorkgroup"
Button8.Text = WinDefend.DisplayName
Button9.Text = MpsSvc.DisplayName
Button10.Text = Themes.DisplayName
Button11.Text = AudioSrv.DisplayName
Button12.Text = "No Service"
regget(0) = My.Computer.Registry.GetValue _
("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOwner", Nothing)
regget(1) = My.Computer.Registry.GetValue _
("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", Nothing)
regget(2) = My.Computer.Registry.GetValue _
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", Nothing)
regget(3) = My.Computer.Registry.GetValue _
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", Nothing)
regget(4) = My.Computer.Registry.GetValue _
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowSuperHidden", Nothing)
regget(5) = My.Computer.Registry.GetValue _
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "SeparateProcess", Nothing)
regget(6) = My.Computer.Registry.GetValue _
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowCompColor", Nothing)
regget(7) = My.Computer.Registry.GetValue _
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "SharingWizardOn", Nothing)
regget(8) = My.Computer.Registry.GetValue _
("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers", "DisableAutoplay", Nothing)
regget(9) = My.Computer.Registry.GetValue _
("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", Nothing)
TextBox1.Text = regget(0)
TextBox2.Text = regget(1)
If regget(2) = 1 And regget(3) = 0 And regget(4) = 1 And regget(5) = 1 And regget(6) = 0 And regget(7) = 0 Then
TextBox3.Text = "OK"
Else
TextBox3.Text = "Error"
End If
If regget(8) = 1 Then
TextBox4.Text = "Disabled"
Else
TextBox4.Text = "Enabled"
End If
If regget(9) = 0 Then
TextBox5.Text = "Disabled"
Else
TextBox5.Text = "Enabled"
End If
For Each objComputer In colSettings
TextBox6.Text = objComputer.Name
TextBox7.Text = objComputer.Workgroup
Next
TextBox8.Text = WinDefend.StartMode & Chr(9) & WinDefend.State
TextBox9.Text = MpsSvc.StartMode & Chr(9) & MpsSvc.State
TextBox10.Text = Themes.StartMode & Chr(9) & Themes.State
TextBox11.Text = AudioSrv.StartMode & Chr(9) & AudioSrv.State
If My.Computer.Registry.GetValue _
("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\wscsvc", "DisplayName", Nothing) Is Nothing Then
TextBox12.Text = "No Service"
Else
Dim wscsvc = objWMIService.Get("Win32_Service.Name='wscsvc'")
Button12.Text = wscsvc.DisplayName
TextBox12.Text = wscsvc.StartMode & Chr(9) & wscsvc.State
End If
End Sub
End Class

0 件のコメント: