Answered msinfo32 commandline on windows 7

  • Thursday, August 09, 2012 11:24 AM
     
     

    Hi,

    I am using msinfo32 command to get the system information from code (executing a process),

    Lets say

    msinfo32 /nfo C:\TEMP\TEST.NFO

    When I run my code on windows 7 a progress bar is shown, while when I run on XP no progress bar is shown, and the command executes silently.

    Progress bar shown on windows 7 also has the button to cancel, which gives control to the user to cancel the command, which I don't want. I don't want the progress bar to be shown on windows 7.

    Note: This also happens when I run the command from command line.

    How this can be achieved?

    Dhanyawaad (Thanks)

All Replies

  • Thursday, August 09, 2012 11:41 AM
     
     Answered
    Use Spy++ to find the window class/text. Hide the Window.
     
    Here's some VB6 code that does it
     
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Public Const SWP_DRAWFRAME = &H20
    Public Const SWP_FRAMECHANGED = &H20        '  The frame changed: send WM_NCCALCSIZE
    Public Const SWP_HIDEWINDOW = &H80
    Public Const SWP_NOACTIVATE = &H10
    Public Const SWP_NOCOPYBITS = &H100
    Public Const SWP_NOMOVE = &H2
    Public Const SWP_NOOWNERZORDER = &H200      '  Don't do owner Z ordering
    Public Const SWP_NOREDRAW = &H8
    Public Const SWP_NOREPOSITION = &H200
    Public Const SWP_NOSIZE = &H1
    Public Const SWP_NOZORDER = &H4
    Public Const SWP_SHOWWINDOW = &H40
     
    Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
     
    Sub Main()
    On Error Resume Next
    HWND_TOPMOST = -1
     
    CmdLine = Command()
    hwindows = FindWindow(vbNullString, CmdLine)
    Ret = SetWindowPos(hwindows, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOREPOSITION + SWP_HIDEWINDOW + SWP_NOMOVE + SWP_NOSIZE)
    If Ret = 0 Then MsgBox "Set Pos Error is " & Err.LastDllError
    End Sub

    --
    .
    --
    "Optimus22" wrote in message news:99c38e16-3990-46d9-930f-1e0a6659623d...

    Hi,

    I am using msinfo32 command to get the system information from code (executing a process),

    Lets say

    msinfo32 /nfo C:\TEMP\TEST.NFO

    When I run my code on windows 7 a progress bar is shown, while when I run on XP no progress bar is shown, and the command executes silently.

    Progress bar shown on windows 7 also has the button to cancel, which gives control to the user to cancel the command, which I don't want. I don't want the progress bar to be shown on windows 7.

    Note: This also happens when I run the command from command line.

    How this can be achieved?

    Dhanyawaad (Thanks)
  • Thursday, August 09, 2012 12:33 PM
     
     

    Thanks,

    But this looks like workaround.

    Is there another standard way?

    Dhanyawaad (Thanks)

  • Friday, August 10, 2012 6:29 AM
    Moderator
     
     Answered
    It is a tool in Windows, I'm afraid that it has no command switch to let you change this behavior: http://support.microsoft.com/kb/300887

    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us

  • Friday, August 10, 2012 9:23 AM
     
     Answered
    What info are you interested in? Does it have to be the binary format. For instance systeminfo.exe gives a lot of info.
    systeminfo >%userprofile%\desktop\systeminfo.txt
    Wmic gives mind numbing detail about many things, below is a few. To see more see wmic /? for common ones and for less common (using the PATH parameter) see http://msdn.microsoft.com/en-us/library/windows/desktop/aa394084(v=vs.85).aspx. You can use >> redirection to append output to an existing file.
     
    wmic /namespace:\\root\wmi PATH MSStorageDriver_FailurePredictStatus get active,predictfailure,reason /format:List
    wmic PATH Win32_VideoController get /format:List
     
    wmic PATH Win32_NTLogEvent get /format:List
     
    wmic PATH Win32_NTLogEvent get eventcode,message /format:List
     
    wmic PATH Win32_SystemUsers get /format:List
    wmic PATH WIN32_UserAccount get /format:List
    wmic PATH WIN32_Account get /format:List
    wmic PATH Win32_LoggedOnUser get /format:List
     
    wmic pagefile get
     
    wmic service get caption,startname
     
    wmic logicaldisk get caption,description,filesystem,volumename,volumedirty,size,freespace
     
    wmic diskdrive get status,model,partitions
     
    wmic baseboard get product,Manufacturer,model,partnumber
     
    wmic startup get caption, command, user
     
    wmic computersystem get CurrentTimeZone, DaylightInEffect,EnableDaylightSavingsTime
     
    wmic recoveros get autoreboot,writetosystemlog,debuginfotype,writedebuginfo
    --
    .
    --
    "Optimus22" wrote in message news:87b5b626-7f92-48ce-8243-2f50be87b308...

    Thanks,

    But this looks like workaround.

    Is there another standard way?

    Dhanyawaad (Thanks)