Jump to content

Recommended Posts

Posted

I have a need to manually import bare metal devices into a database. I have written a script that wraps up the template.csv and a utility called csvimport. It then asks for the tech to enter the device name and MAC address. It takes that info and adds it to another csv file and then runs the csvimport tool to add it to the database.

What I would like to do is pull more data automatically and then use it to send an email. I know AutoIT has the capability to do these things, the problem is that I am new top this and am struggling to get this figured out.

I would like to be able to take the input info for the device name, automatically grab the logged in users email address from AD, and then send a formatted email that would include the newly added device name being sent from the logged in user to a specific helpdesk mailbox. Here is how far I've been able to get on my own. This works and does what I need it to do, but the more advanced functions are beyond my capabilities.

Any help would be greatly appreciated.

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

$csvimport = @scriptdir & "\import.csv"
$importexe = @ScriptDir & "\csvimport.exe"
$importtmp = @ScriptDir & "\template.csv"
$ldscan = "\\server\ldscan"

FileInstall("J:\AutoIT\LANDesk\csvimport.exe", @ScriptDir & "\csvimport.exe", 1)
FileInstall("J:\AutoIT\LANDesk\template.csv", @ScriptDir & "\template.csv", 1)
FileInstall("J:\AutoIT\LANDesk\import.csv", @ScriptDir & "\import.csv", 1)

$Form2 = GUICreate("Bare Metal Import", 296, 210, 416, 179)
$Label1 = GUICtrlCreateLabel("Bare Metal Import utility", 8, 8, 274, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Edit1 = GUICtrlCreateEdit("", 8, 40, 273, 129, 0)
GUICtrlSetData(-1, StringFormat("Some Instructional Text."))
$import = GUICtrlCreateButton("Import New Device", 8, 176, 107, 25)
$Exit = GUICtrlCreateButton("Exit", 176, 176, 107, 25)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Select 
        Case $nMsg = $Exit
            Exit
        Case $nMsg = $Import
            import()
        EndSelect
        
        WEnd

Func import()
    $dname = InputBox("Device Name", "Enter new device name.", "", "")
    $dmac = InputBox("Mac Address", "Enter devices MAC address.", "", "")
    FileDelete($csvimport)
    FileWrite($csvimport, $dname & "," & $dmac)
    Run($importexe & " " & $importtmp & " " & $csvimport & " " & $ldscan)
EndFunc

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
  • Recently Browsing   0 members

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