KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

KixForms - Inventory ( WMIQuery )

 
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive
View previous topic :: View next topic  
Author Message
SoNix
KiXforms Dabbler
KiXforms Dabbler


Joined: 08 Mar 2003
Posts: 8
Location: Canada

PostPosted: Fri Mar 14, 2003 5:56 pm    Post subject: KixForms - Inventory ( WMIQuery ) Reply with quote

i want to share my little software with all of u... Please, contribute and add kewl features to this project...
This Script take a Domain, dump all members of the domain, and get settings from each PC, and create a .csv file, that u can import in Excel after...

Post ur changes

The KixInvent.UDF contain:
Code:

Function WMIQuery( $what, $from, optional $computer, optional $where, optional $x )
   dim $strQuery, $objEnumerator, $value, $item
   If NOT ( $computer )
      $computer="@WKSTA"
   EndIf
   $strQuery = "Select $what From $from"
   If ( $where and $x)
      $strQuery = $strQuery + " Where $where = '$x'"
   EndIf
   $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer")
   If ( @error )
      exit 1
      return
   EndIf
   $objEnumerator = $SystemSet.ExecQuery( $strQuery )
   For Each $objInstance in $objEnumerator
      If  ( @Error = 0 AND $objInstance <> "" )
      $=execute("$$value = $$objInstance.$what")
         Select
            Case VarType($value) = 8204
               For each $item in $value
                  $WMIQuery = "$item" +"|"+"$WMIQuery"
               Next
            Case VarType($value) = 8
               $WMIQuery = "$value"+"|"+"$WMIQuery"
            Case 1
               $WMIQuery = " "
               ; $WMIQuery = "Unhandled data type returned: " + VarTypeName($value) + "(" + VarType($value) + ")"
         EndSelect
      EndIf
   Next
$WMIQuery=left($WMIQuery,len($WMIQuery)-1)
Exit @error
EndFunction

Function WshPipe( $ShellCMD, OPTIONAL $NoEcho )
   Dim $WshShell, $oExec, $AllOutput, $Exit, $WshExitCode
   $WshErrorMsg=""
   $WshShell=CreateObject("WScript.Shell")
   $oExec=$WshShell.Exec($ShellCMD)
   While $Exit<>1
      Dim $Output
         Select
            Case Not $oExec.StdOut.AtEndOfStream
               $Output=$oExec.StdOut.ReadAll
            Case Not $oExec.StdErr.AtEndOfStream
               $Output=$oExec.StdErr.ReadAll
               $WshErrorMsg = $Output
            Case 1
               $Output=-1
         EndSelect
      If $Output=-1
         If $oExec.Status=1
            $Exit=1
         Endif
      Else
         If $NoEcho<>1
            ? $Output
         Endif
      $AllOutput = $AllOutput + $Output
      Endif
   Loop
      $WshExitCode=$oExec.ExitCode
      $WshPipe=split($AllOutput,chr(10))
      Exit($WshExitCode)
EndFunction

FUNCTION WSHPing( $Computer, optional $replies)
   dim $ip, $l, $r, $count, $return, $line ,$pos, $avg
   If NOT $replies      
      $replies=1   
   Endif
   $ip=0      
   $Count=0
   $shell='%comspec% /c ping $Computer -n $replies '
   $return= WSHPipe( $shell,1 )
   if not @error
      for each $line in $return
         select
            case instr($line,"[")      $l=instr($line,"[")+1
                        $r=instr($line,"]")
                        $ip=substr($line,$l,$r-$l)
            case instr($line,"reply from")   $Count=$Count+1
            case instr($line,"Average")   $pos=instr($line,"Average")+8
                        $avg=val(right("$line",len($line)-$pos))
            endselect
         if instr($line,"timed out")   $Count=$Count-1      endif
         next
      $WSHPing=$ip,$count,$avg
   else
      $WSHPing="0.0.0.0","0","0"
      exit(487)
      endif
EndFunction


And The Main Script is:
Code:

break on

$_udfFile = @curdir+"\KixInvent.UDF"
   If Exist ( $_udfFile )
      Call $_udfFile
   Else
      ? "Fichier de libraries introuvable."
      Exit(3)
   EndIf

$__MainForm = CreateObject ( "Kixtart.FORM" )

$__MainForm.caption         = "Kix Inventaire v1.0"
$__MainForm.height         = 600
$__MainForm.width         = 800
$__MainForm.fontname      = "Arial"
$__MainForm.fontsize      = 9
$__MainForm.center

   $__picBanniere         = $__MainForm.PictureBox
   $__picBanniere.backcolor   = $__MainForm.RGB ( 255,255,255 )
   $__picBanniere.height      = 50
   $__picBanniere.width      = ( $__MainForm.width - 25 )
   $__picBanniere.left         = 10
   $__picBanniere.top         = 10
   $__picBanniere.fontsize   = 15
   $__picBanniere.fontname   = "verdana"
   $__picBanniere.forecolor   = 0
   $__picBanniere.printXY   ( 20, 0, "Kix Inventaire v1.0" )
   $__picBanniere.fontsize   = 8
   $__picBanniere.forecolor   = $__MainForm.RGB ( 0,100, 100 )
   $__picBanniere.printXY   ( 23, 32, "Powered by KiX v@KIX and Kixforms "+ $__MainForm.Build +" ")
   $__picBanniere.fontbold   = 1
   $__picBanniere.fontsize   = 11

   $__lstComputers      = $__MainForm.ListView
   $__lstComputers.height      = ( $__MainForm.height - $__picBanniere.height - 60 )
   $__lstComputers.width      = 150
   $__lstComputers.left      = 10
   $__lstComputers.top         = ( $__picBanniere.bottom + 7 )
   $__lstComputers.Sorted = 1                  ; Yes, sort the first column
   $__lstComputers.MultiSelect = True          ; Allow more than one selection
   $__lstComputers.GridLines = True            ; Show gridlines in report view
   $__lstComputers.View = 3                    ; Report view
   $__lstComputers.FullRowSelect = True        ; Allow user to select the entire row
   $= $__lstComputers.Columns.Add( "Ordinateurs" )
      $__lstComputers.Columns.width = 200
   $__lstComputers.Enabled      = 1
   $__lstComputers.OnDoubleClick = "fnClicked()"
   
   $__ProgressForm    = $__MainForm.frame
   $__ProgressForm.width       = ( $__MainForm.width - $__lstComputers.width - 35 )
   $__ProgressForm.height      = 115
   $__ProgressForm.location   = $__lstComputers.width +20 , ( $__MainForm.height - $__ProgressForm.height - 45 )
   $__ProgressForm.text      = "Suivi des Operations"
      $__ProgressTextTotal   = $__ProgressForm.label ( "", 10, 20, $__ProgressForm.width -20 , 20 )
   
      $__ProgressBarTotal       = $__ProgressForm.ProgressBar
      $__ProgressBarTotal.width    =  $__ProgressForm.width - 20
      $__ProgressBarTotal.height    = 20
      $__ProgressBarTotal.center
      $__ProgressBarTotal.top    = $__ProgressTextTotal.bottom

      $__ProgressTextCurrent   = $__ProgressForm.label ( "", 10, 60, $__ProgressForm.width -20, 20 )
      
      $__ProgressBarCurrent       = $__ProgressForm.ProgressBar
      $__ProgressBarCurrent.width    =  $__ProgressForm.width - 20
      $__ProgressBarCurrent.height    = 20
      $__ProgressBarCurrent.center
      $__ProgressBarCurrent.top    = $__ProgressTextCurrent.bottom
   
   $__frmInfos         = $__MainForm.frame
   $__frmInfos.width      = ( $__MainForm.width - $__lstComputers.width - 35 )
   $__frmInfos.height      = ( $__MainForm.height - $__picBanniere.height - $__ProgressForm.height - 60 )
   $__frmInfos.location   = $__lstComputers.width +20 , ( $__picBanniere.bottom  )

   $__cmdScanComputer         = $__frmInfos.CommandButton("Scan Now")
   $__cmdScanComputer.default      = 1 ; True
   $__cmdScanComputer.fontname      = "Arial"
   $__cmdScanComputer.fontsize      = 10
   $__cmdScanComputer.fontbold      = 1
   $__cmdScanComputer.left         = 272
   $__cmdScanComputer.top         = 24
   $__cmdScanComputer.width      = 129
   $__cmdScanComputer.height      = 19
   $__cmdScanComputer.OnClick      = "fnClicked()"
   
$__MainForm.show
   fnGetDomainMembers()
   While $__MainForm.visible
       $ = Execute( $__MainForm.DoEvents )
   Loop
Exit 1


Function fnClicked()
   $_TotalToQuery = $__lstComputers.SelectedItems.Count
   $__ProgressBarTotal.max = $_TotalToQuery
   $__ProgressBartotal.value = 0
   $_ComputerQuery = 0

   If Exist ( @curdir+"\Inventaire.CSV" )
      del( @curdir+"\Inventaire.CSV" )
   EndIf
   
   $ = Open ( 1, @curdir+"\Inventaire.CSV", 5)
   For Each $_computer In $__lstComputers.SelectedItems
      $_ComputerQuery = $_ComputerQuery +1
      $__ProgressBarCurrent.value = 0
      $__ProgressTextTotal.text = "Tentative de connection sur le poste "+ $_computer.text
      $ping = WSHPing( $_computer.text )
      $__ProgressTextTotal.text = "Inventaire de @domain\"+ $_computer.text +" en cours...[ $_ComputerQuery / $_TotalToQuery ]"
         $ = WriteLine ( 1, $_computer.text+"," )
      If ( $ping[0] <> "0.0.0.0" )   
         fnGetInventFrom ( $_computer.text )
      EndIf
         $ = WriteLine ( 1, @crlf )
      $__ProgressBarTotal.value = $__ProgressBarTotal.value +1
   Next
   $ = Close ( 1 )
   ; Remettre les Items a 0
   $__ProgressTextTotal.text = "Inventaire termine."
   $__ProgressTextCurrent.text = ""
   $__ProgressBarTotal.value = 0
   $__ProgressBarCurrent.value = 0
EndFunction


Function fnGetDomainMembers()
   
   $__WaitForm = CreateObject ( "Kixtart.Form" )
   $__WaitForm.caption = "Chargement en cours..."
   $__WaitForm.scalewidth = 500
   $__WaitForm.scaleheight = 100
   $__WaitForm.fontsize = 14
   $__WaitForm.fontname = "Arial"
   $__WaitForm.PrintXY( 30 ,30, "Chargement des ordinateurs membres...")
   $__WaitForm.center
   $__WaitForm.show
   
   $DomainObject = getobject( "WinNT://@domain" )
   $DomainObject.filter = "computer",""
   For each $computer in $DomainObject
      $__lstComputers.AddItem ($computer.name)
   Next
   $__MainForm.Refresh
   $__WaitForm.Hide
EndFunction

Function fnGetInventFrom ( $computer )
      $__ProgressBarCurrent.max = 50
         
   ;   $__ProgressTextCurrent.text = "Recherche du systeme d'exploitation"
   ;   $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
   ;      $_OSSystemName         = WMIQuery ( "CSName", "Win32_OperatingSystem", $computer )         
      $__ProgressTextCurrent.text = "Recherche du type de systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSName            = WMIQuery ( "Caption", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche du Producteur du systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSManfacturer         = WMIQuery ( "Manufacturer", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche de la version du systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSVersionNumber      = WMIQuery ( "Version", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche de la compilation du systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSBuildNumber         = WMIQuery ( "BuildNumber", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche du type de compilation du systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSBuildType         = WMIQuery ( "BuildType", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche du language du systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSLanguage         = WMIQuery ( "OSLanguage", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche de la version du service pack systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSServicePack         = WMIQuery ( "CSDVersion", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche la partition de demarrage"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSBootDevice         = WMIQuery ( "BootDevice", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche la partition  system du Systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSSystemDevice      = WMIQuery ( "SystemDevice", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche du repertoire 'Windows' systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSWindowsDirectory   = WMIQuery ( "WindowsDirectory", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche du repertoire 'systeme' systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSSystemDirectory      = WMIQuery ( "SystemDirectory", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche du proprietaire du systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSRegistredUser      = WMIQuery ( "RegisteredUser", "Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche de l'organisation du systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSRegistredOrg      = WMIQuery ( "Organization"," Win32_OperatingSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche du numero de serie du systeme d'exploitation"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_OSSerialNum         = WMIQuery ( "SerialNumber", "Win32_OperatingSystem", $computer )   ; 17

      $__ProgressTextCurrent.text = "Recherche du manifacturier de la station de travail"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemManufacturer   = WMIQuery ( "Manufacturer", "Win32_ComputerSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche du modele de la station de travail"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemModel         = WMIQuery ( "Model", "Win32_ComputerSystem", $computer )
      $__ProgressTextCurrent.text = "Recherche du numero de serie de la station de travail"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemSerialNum      = WMIQuery ( "SerialNumber", "Win32_BIOS", $computer )
      $__ProgressTextCurrent.text = "Recherche de la version du BIOS de la station de travail"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemBIOSVersion      = WMIQuery ( "SMBIOSBIOSVersion", "Win32_BIOS", $computer )
      $__ProgressTextCurrent.text = "Recherche de la date du BIOS de la station de travail"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemBIOSDate      = WMIQuery ( "Version", "Win32_BIOS", $computer)               ; 22
      
      $__ProgressTextCurrent.text = "Recherche le manifacturier du processeur"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPUManufacturer      = WMIQuery ( "manufacturer", "Win32_Processor", $computer )
      $__ProgressTextCurrent.text = "Recherche la description du processeur"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPUDescription      = WMIQuery ( "description", "Win32_Processor", $computer )
      $__ProgressTextCurrent.text = "Recherche la vitesse acutel du processeur"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPUSpeed            = WMIQuery ( "CurrentClockSpeed", "Win32_Processor", $computer )
      $__ProgressTextCurrent.text = "Recherche la vitesse maximum du processeur"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPUMaxSpeed         = WMIQuery ( "maxclockspeed", "Win32_Processor", $computer )
      $__ProgressTextCurrent.text = "Recherche de la grosseur du Cache L2"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPUL2CacheSize      = WMIQuery ( "l2cachesize", "Win32_Processor", $computer )
      $__ProgressTextCurrent.text = "Recherche la vitesse du Cache L2"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPUL2CacheSpeed      = WMIQuery ( "l2cachespeed", "Win32_Processor", $computer )
      $__ProgressTextCurrent.text = "Recherche la famille du processeur"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPUFamily            = WMIQuery ( "family", "Win32_Processor", $computer )
      $__ProgressTextCurrent.text = "Recherche le niveau de production du processeur"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPULevel            = WMIQuery ( "level", "Win32_Processor", $computer )
      $__ProgressTextCurrent.text = "Recherche le stepping du processeur"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPUStepping         = WMIQuery ( "stepping", "Win32_Processor", $computer )
      $__ProgressTextCurrent.text = "Recherche du numero de production du processeur"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPUDeviceID         = WMIQuery ( "deviceid", "Win32_Processor", $computer )
      $__ProgressTextCurrent.text = "Recherche du numero unique du processeur"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_CPUUniqueID         = WMIQuery ( "uniqueid", "Win32_Processor", $computer )            ; 33
      
      $__ProgressTextCurrent.text = "Recherche de la memoire Installer sur le systeme"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
      $__SystemMemory            = val( WMIQuery ( "Capacity", "Win32_PhysicalMemory", $computer ))/1048576
         $__SystemMemoryDimm = "("
         For Each $dimm In Split( WMIQuery( "Capacity", "Win32_PhysicalMemory", $computer ), "|" )
                  $__SystemMemoryDimm = $__SystemMemoryDimm +""+ val($dimm) / 1048576 +" Mb/"
            Next
         $__SystemMemoryDimm = $__SystemMemoryDimm+ ")"
      $__ProgressTextCurrent.text = "Recherche des partitions sur le systeme"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemDiskLogic      = WMIQuery ( "name", "Win32_LogicalDisk", $computer )
      $__ProgressTextCurrent.text = "Recherche des volumes present dans le systeme"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemVolumeName      = WMIQuery ( "volumename", "Win32_LogicalDisk", $computer )
      $__ProgressTextCurrent.text = "Recherche la grosseur des partitions presente sur le systeme"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemVolumeSize      = WMIQuery ( "size", "Win32_LogicalDisk", $computer )
      $__ProgressTextCurrent.text = "Recherche du type de partition presente sur le systeme"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemFileSystem      = WMIQuery ( "filesystem", "Win32_LogicalDisk", $computer )
      $__ProgressTextCurrent.text = "Recherche de l'espace libre sur chacune des partitions"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemFreeSpace      = WMIQuery ( "freespace", "Win32_LogicalDisk", $computer )
      $__ProgressTextCurrent.text = "Recherche de la carte video du systeme"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemVideoCard      = WMIQuery ( "Description", "Win32_VideoController", $computer )
      $__ProgressTextCurrent.text = "Recherche de la resolution de l'utilisateur"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemVideoRes      = WMIQuery ( "VideoModeDescription", "Win32_VideoController", $computer )
      $__ProgressTextCurrent.text = "Recherche de la carte reseau"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_SystemNIC            = trim ( WMIQuery ( "Description", "Win32_NetworkAdapterConfiguration", $computer, "IPEnabled", "True" ))

      $__ProgressTextCurrent.text = "Recherche de l'adresse IP du systeme"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_IPSystem            = trim ( WMIQuery ( "IPAddress", "Win32_NetworkAdapterConfiguration", $computer, "IPEnabled", "True" ))
      $__ProgressTextCurrent.text = "Recherche du masque de sous-reseau du systeme"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_IPSubnet            = trim ( WMIQuery ( "IPSubnet", "Win32_NetworkAdapterConfiguration", $computer, "IPEnabled", "True" ))
      $__ProgressTextCurrent.text = "Recherche de la carte reseau"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_IPGateway            = trim ( WMIQuery ( "DefaultIPGateway", "Win32_NetworkAdapterConfiguration", $computer, "IPEnabled", "True" ))
      $__ProgressTextCurrent.text = "Recherche de la configuration DHCP"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_IPDHCPEnabled         = trim ( WMIQuery ( "DHCPEnabled", "Win32_NetworkAdapterConfiguration", $computer, "IPEnabled", "True" ))
      $__ProgressTextCurrent.text = "Recherche de la configuration WINS"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_IPWINSPrimaryServer   = trim ( WMIQuery ( "WINSPrimaryServer", "Win32_NetworkAdapterConfiguration", $computer, "IPEnabled", "True" ))
         
      $__ProgressTextCurrent.text = "Recherche des imprimantes installee sur LPT1"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_PrinterLPT1 = "("
         For Each $printer In Split( WMIQuery( "Name", "Win32_printer", $computer, "PortName", "LPT1:" ), "|" )   
               $_PrinterLPT1 = $_PrinterLPT1 +"LPT1=$printer/"
         Next
         $_PrinterLPT1 = $_PrinterLPT1 +")"      
      $__ProgressTextCurrent.text = "Recherche des imprimantes installee sur LPT2"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_PrinterLPT2 = "("
         For Each $printer In Split( WMIQuery( "Name", "Win32_printer", $computer, "PortName", "LPT2:" ), "|" )   
               $_PrinterLPT2 = $_PrinterLPT2 +"LPT2=$printer/"
         Next
         $_PrinterLPT2 = $_PrinterLPT2 +")"      
      $__ProgressTextCurrent.text = "Recherche des imprimantes installee sur LPT3"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_PrinterLPT3 = "("
         For Each $printer In Split( WMIQuery( "Name", "Win32_printer", $computer, "PortName", "LPT3:" ), "|" )   
               $_PrinterLPT3 = $_PrinterLPT3 +"LPT3=$printer/"
         Next
         $_PrinterLPT3 = $_PrinterLPT3 +")"      
      $__ProgressTextCurrent.text = "Recherche des imprimantes installee sur COM1"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_PrinterCOM1 = "("
         For Each $printer In Split( WMIQuery( "Name", "Win32_printer", $computer, "PortName", "COM1:" ), "|" )   
               $_PrinterCOM1 = $_PrinterCOM1 +"COM1=$printer/"
         Next
         $_PrinterCOM1 = $_PrinterCOM1 +")"      
      $__ProgressTextCurrent.text = "Recherche des imprimantes installee sur COM2"
      $__ProgressBarCurrent.value = $__ProgressBarCurrent.value +1
         $_PrinterCOM2 = "("
         For Each $printer In Split( WMIQuery( "Name", "Win32_printer", $computer, "PortName", "COM2:" ), "|" )   
               $_PrinterCOM2 = $_PrinterCOM2 +"COM2=$printer/"
         Next
         $_PrinterCOM2 = $_PrinterCOM2 +")"      

   $_InvOS      = "$_OSName,$_OSManfacturer,$_OSVersionNumber,$_OSBuildNumber,$_OSBuildType,$_OSLanguage,$_OSServicePack,"
         +"$_OSBootDevice,$_OSSystemDevice,$_OSRegistredUser,$_OSRegistredOrg,$_OSSerialNum"
   $_InvCPU    = "$_CPUManufacturer,$_CPUDescription,$_CPUSpeed,$_CPUMaxSpeed,$_CPUL2CacheSize,$_CPUL2CacheSpeed,$_CPUFamily,$_CPULevel,"
         +"$_CPUStepping,$_CPUDeviceID,$_CPUUniqueID"
   $_InvSystem = "$__SystemMemory,$__SystemMemoryDimm,$_SystemDiskLogic,$_SystemVolumeName,$_SystemVolumeSize,$_SystemFileSystem,"
         +"$_SystemFreeSpace,$_SystemVideoCard,$_SystemVideoRes"
   $_InvIP      = "$_SystemNIC,$_IPSystem,$_IPSubnet,$_IPGateway,$_IPDHCPEnabled,$_IPWINSPrimaryServer"
   $_InvPrinter= "$_PrinterLPT1,$_PrinterLPT2,$_PrinterLPT3,$_PrinterCOM1,$_PrinterCOM2"
   
   $_InvStr = $_InvOS +","+ $_InvCPU +","+ $_InvSystem +","+ $_InvIP  +","+ $_InvPrinter
   $ = WriteLine ( 1, $_InvStr )
EndFunction

Code:
Back to top
View user's profile Send private message
ntdoc
KiXforms Supporter
KiXforms Supporter


Joined: 05 Mar 2003
Posts: 77
Location: Mouse Country

PostPosted: Thu Mar 20, 2003 8:14 am    Post subject: Reply with quote

SoNiX,

Nice idea and form guy.

Some comments:

1.
Sorry, not to complain but the KiXtart community as a whole reads/writes in English. I don't know what many of your dialogs say.

2.
Seems to work well for LOCAL system, but remote systems come back with blank data

3.
Would be nice to maybe change the Inventaire.CSV file to match the name of the computer.

4.
Unless you plan to really branch this out to an even larger program, I'd prefer all the code be included in the same file as the form script.

Thanks for posting.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Co
KiXforms Regular
KiXforms Regular


Joined: 09 Oct 2003
Posts: 31
Location: The Netherlands

PostPosted: Wed Nov 12, 2003 11:05 am    Post subject: Reply with quote

Well, I know a new project for you: A kixform French <-> English dictionary Wink
But I like your Idea..

_________________
Groeten,

Co

_______________

A little knowledge is a dangerous thing
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group