Jump to content

wmic commands


pcjunki
 Share

Recommended Posts

here is my simple gui that runs a few wmic commands
 
current user logged on
model of the computer
serial number of the computer
and the bios version of the computer
 
just type in a computer name, choose a command and then click on "run wmic"

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("wmic commands", 300, 152, 337, 380)

$Label1 = GUICtrlCreateLabel("Computername", 0, 8, 75, 17)
$Input1 = GUICtrlCreateInput("", 0, 32, 125, 21)

$Label2 = GUICtrlCreateLabel("wmic command", 150, 8, 77, 17)
$Combo1 = GUICtrlCreateCombo("", 150, 32, 125, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Current_user|Model_Computer|Serial_Number|Bios_Version")

$Button1 = GUICtrlCreateButton("run wmic", 150, 72, 91, 49)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         case $button1
            $wmi = GUICtrlRead($combo1)
            $pc = GUICtrlRead($input1)
            call($wmi,$pc)

    EndSwitch
 WEnd

Func Current_user($pc)
RunWait(@ComSpec & ' /c ' & 'wmic /node:' & $pc &' computersystem get username > %temp%\username.txt' ,"", @SW_HIDE)
$file=(@TempDir & "/username.txt")
$fileread= FileRead($file)
MsgBox(0, $pc , $fileread)
FileDelete(@TempDir & "/username.txt")
EndFunc


Func Model_Computer($pc)
RunWait(@ComSpec & ' /c ' & 'wmic /node:' & $pc &' computersystem get model > %temp%\model.txt' ,"", @SW_HIDE)
$file=(@TempDir & "/model.txt")
$fileread= FileRead($file)
MsgBox(0, $pc , $fileread)
FileDelete(@TempDir & "/model.txt")
EndFunc


Func Serial_Number($pc)
RunWait(@ComSpec & ' /c ' & 'wmic /node:' & $pc &' bios get serialnumber > %temp%\serial.txt' ,"", @SW_HIDE)
$file=(@TempDir & "/serial.txt")
$fileread= FileRead($file)
MsgBox(0, $pc , $fileread)
FileDelete(@TempDir & "/serial.txt")
EndFunc



Func Bios_Version($pc)
RunWait(@ComSpec & ' /c ' & 'wmic /node:' & $pc &' bios get smbiosbiosversion > %temp%\bios.txt' ,"", @SW_HIDE)
$file=(@TempDir & "/bios.txt")
$fileread= FileRead($file)
MsgBox(0, $pc , $fileread)
FileDelete(@TempDir & "/bios.txt")
EndFunc

wmic commands.au3

Edited by pcjunki
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...