pranaynanda

WMI and AutoIt

4 posts in this topic

I want to pop a message on each machine on our network. The message will be a simple AutoIt message. I need help with the WMI part or the deployment process.

Share this post


Link to post
Share on other sites



@pranaynanda,

this has nothing to do with WMI beyond regular use. if you want to get any response at all, ask a Mod to move this topic to General Help and Support.

now, have you looked at msg.exe? have you googled "sending a message over network"?

and in principal, are you aware you are going to be irritating a lot of users, by sending them messages which they see as completely unimportant?

Share this post


Link to post
Share on other sites

@orbs I have searched that enough and could not figure out a way that way most optimal. And of course, as an IT admin, I have the responsibility to keep my users informed about the changes coming their way. I put this forum here because I need help with the WMI part or the part to make that work over a network. I only have to create something like a splash screen in AutoIt

Share this post


Link to post
Share on other sites

In the Example Scripts Forum you find Scriptomatic. This tool generates AutoIt code for you.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2016-08-18 - Version 1.4.6.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2016-12-04 - Version 1.2.2.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
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

  • Similar Content

    • TheDcoder
      WMI Object Code conversion to AutoIt
      By TheDcoder
      Hello, I found a VB snippet which I would love to use in AutoIt
      strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_Process") For Each objItem in colItems Wscript.Echo objItem.Name Wscript.Echo objItem.CommandLine Next Despite my best efforts, I am not able to understand a thing from that piece of code . All I know is that it outputs the Name and Commandline of all the processes currently running (Let's see if I am right).
      Can anyone help me with convert this into AutoIt? Thanks in Advance!
    • jguinch
      Printers Management UDF
      By jguinch
      Hello.
      I did create these few functions several months ago. I post here, if it can interest someone.
      These functions based on WMI queries allow you to manage printers : add / delete printer, driver, port, or obtain configuration, set default printer ... I let you discover it with the code.

      WARNING : this UDF has been updated (july 2016). Function names have changed.
      The previous (old) version is available (for now)  to download at the top of this message.
       
      Here is the list of the available functions :
      _Printmgr_AddLocalPort
      _PrintMgr_AddPrinter
      _PrintMgr_AddPrinterDriver
      _PrintMgr_AddTCPIPPrinterPort
      _PrintMgr_AddWindowsPrinterConnection
      _PrintMgr_CancelAllJobs
      _PrintMgr_EnumPrinter
      _PrintMgr_EnumPrinterConfiguration
      _PrintMgr_EnumPrinterDriver
      _PrintMgr_EnumPrinterProperties
      _Printmgr_Pause
      _Printmgr_PrinterExists
      _Printmgr_PrintTestPage
      _PrintMgr_RemoveLocalPrinterPort
      _PrintMgr_RemovePrinter
      _PrintMgr_RemovePrinterDriver
      _PrintMgr_RemoveTCPIPPrinterPort
      _PrintMgr_RenamePrinter
      _Printmgr_Resume
      _PrintMgr_SetDefaultPrinter
       
      And some examples :
      #Include "PrintMgr.au3" ; Remove a printer called "My old Lexmark printer" : _PrintMgr_RemovePrinter("My old Lexmark printer") ; Remove the driver called "Lexmark T640" : _PrintMgr_RemovePrinterDriver("Lexmark T640") ; Remove the TCP/IP printer port called "TCP/IP" _PrintMgr_RemoveTCPIPPrinterPort("MyOLDPrinterPort") ; Add a driver, called "Samsung ML-451x 501x Series", and driver inf file is ".\Samsung5010\sse2m.inf" _PrintMgr_AddPrinterDriver("Samsung ML-451x 501x Series", "Windows NT x86", @scriptDir & "\Samsung5010", @scriptDir & "\Samsung5010\sse2m.inf") ; Add a TCP/IP printer port, called "MyTCPIPPrinterPort", with IPAddress = 192.168.1.10 and Port = 9100 _PrintMgr_AddTCPIPPrinterPort("MyTCPIPPrinterPort", "192.168.1.10", 9100) ; Add a printer, give it the name "My Printer", use the driver called "Samsung ML-451x 501x Series" and the port called "MyTCPIPPrinterPort" _PrintMgr_AddPrinter("My Printer", "Samsung ML-451x 501x Series", "MyTCPIPPrinterPort") ; Set the printer called "My Printer" as default printer _PrintMgr_SetDefaultPrinter("My Printer") ; Connect to the shared printer "\\192.168.1.1\HPDeskjetColor") _PrintMgr_AddWindowsPrinterConnection("\\192.168.1.1\HPDeskjetColor") ; List all installed printers #Include <Array.au3> $aPrinterList = _PrintMgr_EnumPrinter() _ArrayDisplay($aPrinterList) ; List all printers configuration #Include <Array.au3> $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration() _ArrayDisplay($aPrinterConfig) ; List all installed printer drivers #Include <Array.au3> $aDriverList = _EnumPrinterDriver() _ArrayDisplay($aDriverList) ; Retrieve the printer configuration for the printer called "Lexmark T640" #Include <Array.au3> $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration("Lexmark T640") _ArrayDisplay($aPrinterConfig) ; Add a local printer port (for a file output) _AddLocalPrinterPort("c:\temp\output.pcl") ; Remove the local port _RemoveLocalPrinterPort("c:\temp\output.pcl") Current version download link :
      PrintMgr.au3
    • Irios
      How to enumerate all properties in an object variable (wmi) when I don't know their names? [SOLVED!]
      By Irios
      First post here, please be gentle
       
      I've spent hours and hours trying to figure out this puzzle. It's impossible to google for because I don't know the precise terminology to use. All msdn links I find are either dead or has been removed like 10 years ago.
       
      Here is a tiny code example:
      $objWMIService = ObjGet("winmgmts:") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_Tcpip_NetworkInterface Where Name like '%intel%'") For $objItem In $colItems ConsoleWrite($objItem.PacketsPersec & @CRLF) Next In that example I'm using the asterix * and it retrieves all properties in the "Win32_PerfRawData_Tcpip_NetworkInterface" class.  But I'm only utilizing "PacketsPersec" in the example.
      How could I enumerate all the properties without defining their names beforehand?
      (FYI, I do know their names, but the script doesn't know the names)
      In other words; how can I use "SELECT *" on any class and output all properties, one by one? Without having to manually specify each property with $objItem.<propertyname> ?

      As comparison, using wmic in a cmd shell ...
          wmic path Win32_PerfRawData_Tcpip_NetworkInterface  Where "Name like '%intel%'" get /value
      ...and it lists all properties in "Names=Value" manner.
      This is sort of the same function I'm looking for. How could I do the same in Autoit?
       
       
      EDIT: I cannot run a powershell or cmd  to "solve" the problem.  I need to find a way to do this "internally" in Autoit. I.e. by calling the WMI service directly with ObjGet(winmgmts:) or connect to the WMI system with CreateObject("WbemScripting.SWbemLocator"). Performance is a major factor.
    • blumi
      TPM status with wmi
      By blumi
      I found a website where it is explained how to use wmi to check the tpm status of the tmp security chip.
      http://windowsitpro.com/security/checking-status-trusted-platform-module-command-line
      I tried this with autoit, but had no success.
      Anyone here who can give little support to me?
      Thanks
      #include <Array.au3> $ScriptName = "TPM Status" Dim $sResult $strComputer = "lapxxx" $objWMIService = ObjGet("wmic /namespace:\\.\root\cimv2\security\microsofttpm") ;$objWMIService = ObjGet("wmic /namespace:\\" & $strComputer & "\root\cimv2\security\microsofttpm") ;$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colItems = $objWMIService.InstancesOf("Select * from Win32_Tpm") For $objItem In $colItems $IsActivated = $objItem.IsActivated_InitialValue $IsEnabled = $objItem.IsEnabled_InitialValue MsgBox(0, $ScriptName, "IsActivated: " & $IsActivated & @CRLF & _ "IsEnabled: " & $IsEnabled & @CRLF & _ "x: " ) Next $oMTpm = ObjGet("winmgmts:\\.\root\cimv2\Security\MicrosoftTpm") $oCol = $oMTpm.InstancesOf("Win32_Tpm") For $oObj In $oCol ConsoleWrite($oObj.IsActivated_InitialValue & @CRLF) ConsoleWrite($oObj.IsEnabled_InitialValue & @CRLF) ConsoleWrite($oObj.IsOwned_InitialValue & @CRLF) ConsoleWrite($oObj.SpecVersion & @CRLF) ConsoleWrite($oObj.ManufacturerVersion & @CRLF) ConsoleWrite($oObj.ManufacturerVersionInfo & @CRLF) ConsoleWrite($oObj.ManufacturerId & @CRLF) ConsoleWrite($oObj.PhysicalPresenceVersionInfo & @CRLF) Next  
       
    • jguinch
      Printer Management UDF
      By jguinch
      Here is an UDF for managing printers.
      Features are :
       - add, remove or rename a printer
       - add or remove a driver
       - add or remove a TCP/IP printer port
       - connect to a remote printer
       - enum printers and there configuration and properties
       - pause resume or cancel all jobs of a printer
       - checks if a printer exists
       - print a test page
       - set the default printer