Der nachfolgende Code listet alle Startupcommandos eines Systems auf und gibt sie als String wieder aus.
Dies kann zur Diagnose herangezogen werden
Function GetAllStartUpCommands() As String
Dim s As New StringBuilder
Dim strComputer As String = "."
Dim objWMIService As Object = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Dim colStartupCommands As Object = objWMIService.ExecQuery _
("Select * from Win32_StartupCommand")
For Each objStartupCommand As Object In colStartupCommands
s.AppendLine("Command: " & objStartupCommand.Command)
s.AppendLine("Description: " & objStartupCommand.Description)
s.AppendLine("Location: " & objStartupCommand.Location)
s.AppendLine("Name: " & objStartupCommand.Name)
s.AppendLine("Setting ID: " & objStartupCommand.SettingID)
s.AppendLine("User: " & objStartupCommand.User)
s.AppendLine("")
Next
Return s.ToString
End Function
2 Kommentare zum Snippet