
PnoT
Active Members-
Posts
24 -
Joined
-
Last visited
Everything posted by PnoT
-
We're in need of some licensing management at my job and was wondering if anyone else had embarked on a project of this type with AutoIT before? It shouldn't be too hard to use magic jellybean to pull the keys and find a way to dump those into a SQL database. I believe WMI could also play a part in grabbing data as well. Any thoughts? Here is the link for Magic Jelly Bean btw: http://www.magicaljellybean.com/keyfinder/
-
Is it possible to run a function with elevated privs?
PnoT replied to PnoT's topic in AutoIt General Help and Support
How is that accomplished? -
Is it possible to run a function with elevated privs?
PnoT replied to PnoT's topic in AutoIt General Help and Support
Try running an application with Runas or using #Requireadmin and then try and poll @Username. It will pull the admins username instead of the current logged on user. That is an issue for me. I need the application to pull all the current user's info but also need the ability to run a function or command as an admin. The tool I've built is for technical support but things such as installing a program, with a button i have created in the gui, will not work without admin rights. Is there some way to get around this? -
I need my program to run as a user (non admin) but certain buttons that are tied to _functions will need to be run as an admin. Is this possible? If not what are my alternatives? I could use the button to run an additional .exe script with the RunAs command but that seems like a waste and I'll have to deploy more files to every machine. I was also toying with the idea of using #RequireAdmin in the script, which would make all of my admin _functions work BUT will throw off the @Username @homeshare and other variables i need intact.
-
Display multiple WMI variables in GUI
PnoT replied to PnoT's topic in AutoIt General Help and Support
I wound up creating my own function and happy to report it's working like a champ! In doing so it freed up some code elsewhere in my script so a win/win. func _Checkmark($left, $top, $width, $height) GUICtrlCreateLabel(Chr(214), $left, $top, $width, $height) GUICtrlSetFont(-1, 9, 700, 4, "Symbol") GUICtrlSetColor(-1, 0x008000) EndFunc Func _DriveMap() DriveMapDel("P:") DriveMapDel("S:") DriveMapAdd("S:", "\\share1$", 1) DriveMapAdd("P:", "\\share2$", 1) $S = DriveMapGet("S:") $P = DriveMapGet("P:") If $P = "\\share2$" then GUICtrlCreateLabel($P, 48, 174, 180, 17) sleep(1000) _Checkmark(227,174,41,17) EndIf sleep(1000) If $S = "\\share1$" Then GUICtrlCreateLabel($S, 48, 199, 180, 17) sleep(1000) _Checkmark(227,199,41,17) EndIf EndFunc ;==>_DriveMap Thank you for your invaluable help on the core of this project. -
Display multiple WMI variables in GUI
PnoT replied to PnoT's topic in AutoIt General Help and Support
Here is what i have now and it's not working for me: Global $H = DriveMapGet("H:") Global $P = DriveMapGet("P:") Global $S = DriveMapGet("S:") Global $PC = GUICtrlCreateLabel(Chr(214), 227, 174, 41, 17) ;the "checkmark" Global $PS = GUICtrlCreateLabel(Chr(214), 227, 199, 41, 17) ;the "checkmark" Func _DriveMap() DriveMapDel("P:") DriveMapDel("S:") DriveMapAdd("S:", "\\share1$", 1) DriveMapAdd("P:", "\\share2$", 1) If $P = "\\share2$" Then GUICtrlSetState($PC,Chr(214)) EndIf EndFunc ;==>_DriveMap -
Display multiple WMI variables in GUI
PnoT replied to PnoT's topic in AutoIt General Help and Support
Here is what I have so far: #include <Array.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <services.au3> $array = _NicToggle('Display') _RenderGUI($array, "MYIT Support Tool") Func _RenderGUI($array, $GuiName) Local $offset1 = 0 $hGUI = GUICreate($GuiName, 459, 477) For $i = 1 To $array[0][0] GUICtrlCreateLabel($array[$i][1], 26, 31 + $offset1, 200, 17) GUICtrlCreateLabel($array[$i][3], 246, 31 + $offset1, 70, 17) GUICtrlCreateLabel($array[$i][5], 346, 31 + $offset1, 90, 17) $offset1 = $offset1 + 20 Next $H = DriveMapGet("H:") $P = DriveMapGet("P:") $S = DriveMapGet("S:") GUICtrlCreateGroup("Network Connection ID", 20, 15, 186, 105) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("IP", 240, 15, 96, 105) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Gateway", 340, 15, 96, 105) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Current Drive Mappings and Ping Check", 20, 124, 418, 100, $BS_CENTER) GUICtrlCreateLabel("Server", 281, 149, 61, 20) GUICtrlCreateLabel("Server2", 281, 174, 61, 20) GUICtrlCreateLabel("", 152, 144, 31, 17) GUICtrlSetFont(-1, 9, 800, 4, "Symbol") GUICtrlSetColor(-1, 0x001F40) GUICtrlCreateLabel("", 152, 168, 28, 17) GUICtrlSetFont(-1, 9, 800, 4, "Symbol") GUICtrlSetColor(-1, 0x001F40) GUICtrlCreateLabel("H:", 32, 149, 15, 17) GUICtrlCreateLabel("P:", 32, 174, 14, 17) GUICtrlCreateLabel("S:", 32, 199, 14, 17) GUICtrlCreateLabel($H, 48, 149, 180, 17) GUICtrlCreateLabel($P, 48, 174, 180, 17) GUICtrlCreateLabel($S, 48, 199, 180, 17) GUICtrlCreateLabel("", 227, 149, 41, 17) ; this is a placeholder for when i get H: drive AD polling integrated GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Computer Information", 20, 232, 417, 121) GUICtrlCreateLabel("Computer Name:", 24, 256, 83, 17) GUICtrlCreateLabel("User:", 24, 280, 29, 17) GUICtrlCreateLabel("Home Folder:", 24, 304, 67, 17) GUICtrlCreateLabel("Domain Controller:", 24, 328, 90, 17) GUICtrlCreateLabel(@ComputerName, 120, 256, 125, 17) GUICtrlCreateLabel(@LogonDomain & "\" & @UserName, 120, 280, 125, 17) GUICtrlCreateLabel(@HomeShare, 120, 304, 125, 17) GUICtrlCreateLabel(@LogonServer, 120, 328, 125, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("Tools", 20, 364, 417, 81) $MD = GUICtrlCreateButton("Map Drives", 24, 392, 75, 25, $WS_GROUP) $SF = GUICtrlCreateButton("Spark Fix", 104, 392, 75, 25, $WS_GROUP) $SL = GUICtrlCreateButton("SL Fix", 184, 392, 75, 25, $WS_GROUP) $DA = GUICtrlCreateButton("DA Fix", 264, 392, 75, 25, $WS_GROUP) GUICtrlCreateGroup("", -99, -99, 1, 1) $Exit = GUICtrlCreateButton("EXIT", 360, 448, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) GUISetState() Sleep(1000) If $P = "\\share1$" Then $PC = GUICtrlCreateLabel(Chr(214), 227, 174, 41, 17) ;the "checkmark" GUICtrlSetFont(-1, 9, 700, 4, "Symbol") GUICtrlSetColor(-1, 0x008000) EndIf GUISetState() Sleep(1000) If $S = "\\share2$" Then $PS = GUICtrlCreateLabel(Chr(214), 227, 199, 41, 17) ;the "checkmark" GUICtrlSetFont(-1, 9, 700, 4, "Symbol") GUICtrlSetColor(-1, 0x008000) EndIf GUISetState() Sleep(1000) $ping = Ping("server", 250) If @error = 0 Then GUICtrlCreateLabel(Chr(214), 368, 149, 41, 17) ;the "checkmark" GUICtrlSetFont(-1, 9, 700, 4, "Symbol") GUICtrlSetColor(-1, 0x008000) Else GUICtrlCreateLabel("FAILED", 368, 149, 41, 17) EndIf GUISetState() Sleep(1000) $ping2 = Ping("server2", 250) If @error = 0 Then GUICtrlCreateLabel(Chr(214), 368, 174, 48, 17) ;the "checkmark" GUICtrlSetFont(-1, 9, 700, 4, "Symbol") GUICtrlSetColor(-1, 0x008000) Else GUICtrlCreateLabel("FAILED", 368, 174, 48, 17) EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $SL ;;;_SLFIX() Case $MD _DriveMap() Case $DA ;; Case $Exit Exit EndSwitch WEnd EndFunc ;==>_RenderGUI ;=============================================================================== ; ; Description: Display/Enable/Dissable any Nics via MAC/IP/Name ; ; Syntax: _NicToggle('DisAble','Local Area Connection 2') ; ; Parameter(s): $action = 'Display': Returns Array of all Nics ; 'DisAble': DisAbles specified Nic ; 'Enable': Enables specified Nic ; ; $NetName = If Enable/DisAble then Specify the Nic Name ; ; Requirement(s): None ; ; Author(s): ; ;=============================================================================== Func _NicToggle($action = 'Display', $NetName = '0') Local $output[1][6] = [['0', 'ID', 'Status', 'IPAddress', 'MACAddress', 'Gateway']] Local $strComputer = "." Local $objNetwork = ObjCreate("WScript.Network") $strComputer = $objNetwork.ComputerName Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration") Local $IP, $o_WMIService, $a_CollectedConnections For $objItem In $colItems $IP = $objItem.IPAddress(0) $o_WMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") $a_CollectedConnections = $o_WMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", 0x20 + 0x10) For $o_ConnectionItem In $a_CollectedConnections If $o_ConnectionItem.NetConnectionID <> "" And $o_ConnectionItem.MACAddress = $objItem.MACAddress Then $skip = 0 For $i = 1 To $output[0][0] If $o_ConnectionItem.NetConnectionID = $output[$i][1] Then $skip = 1 ;Duplicate reported EndIf Next ;MsgBox(0,'$skip ='&$skip ,$o_ConnectionItem.NetConnectionID) If $skip = 0 Then ReDim $output[$output[0][0] + 2][6] $output[0][0] = $output[0][0] + 1 $output[$output[0][0]][1] = $o_ConnectionItem.NetConnectionID $output[$output[0][0]][2] = $o_ConnectionItem.NetConnectionStatus $output[$output[0][0]][3] = $objItem.IPAddress(0) $output[$output[0][0]][4] = $o_ConnectionItem.MACAddress $output[$output[0][0]][5] = $objItem.DefaultIPGateway(0) EndIf EndIf Next Next If $action = 'DisAble' Then If $NetName = '0' Then MsgBox(0, 'CRITICAL ERROR', 'Must provide a name to Disable') Else If @OSVersion = 'WIN_XP' Then ;Tested: XPx86 RunWait(@ComSpec & ' /c devcon.exe disable "' & String($NetName) & '"', "", @SW_HIDE) ElseIf @OSVersion = 'WIN_2008' And FileExists('X:\windows\system32') Then ;Tested: PE _Nic_NetCC($NetName, 0) ElseIf @OSVersion = 'WIN_2003' Or @OSVersion = 'WIN_2008' Or @OSVersion = 'WIN_VISTA' Then ;Tested: 2k3x64, _Nic_NetCC($NetName, 0) EndIf EndIf ElseIf $action = 'Enable' Then If $NetName = '0' Then MsgBox(0, 'CRITICAL ERROR', 'Must provide a name to Enable') Else If @OSVersion = 'WIN_XP' Then ;Tested: XPx86 RunWait(@ComSpec & ' /c devcon.exe enable "' & String($NetName) & '"', "", @SW_HIDE) ElseIf @OSVersion = 'WIN_2008' And FileExists('X:\windows\system32') Then ;Tested: PE _Nic_NetCC($NetName, 1) ElseIf @OSVersion = 'WIN_2003' Or @OSVersion = 'WIN_2008' Or @OSVersion = 'WIN_VISTA' Then ;Tested: 2k3x64, _Nic_NetCC($NetName, 1) EndIf EndIf Else ;Display Output Return $output EndIf EndFunc ;==>_NicToggle Func _Nic_NetCC($oLanConnection, $iFlag);0 = Disable connection, 1 = Enable connection (default) If @OSType <> "WIN32_NT" Then Return SetError(1, 0, 0) ; Control OS type. If StringInStr("WIN_2000,WIN_XP,WIN_2003", @OSVersion) Then ;W2K/XP/W2K3 $Res = _Nic_NetCCWin32($oLanConnection, $iFlag, 1) Else ;Vista/W2K8 If $iFlag = 3 Then Return SetError(5, 0, 0) $Res = _Nic_NetCCWin32New($oLanConnection, $iFlag, 1) EndIf Return SetError(@error, @extended, $Res) EndFunc ;==>_Nic_NetCC Func _Nic_NetCCWin32($oLanConnection, $iFlag = 1, $iFullName = 1); Only for W2K/XP/W2K3 Local $objShell, $objFolder $objShell = ObjCreate("Shell.Application") If Not IsObj($objShell) Then Return SetError(2, 0, 0) $objFolder = $objShell.NameSpace(0x31) If Not IsObj($objFolder) Then Return SetError(3, 0, 0) ; Find the collection of the network connection name. For $LanItem In $objFolder.Items If StringLower($LanItem.Name) = StringLower($oLanConnection) Then $oLanConnection = $LanItem ExitLoop EndIf Next ; If no network connection name then return error. If Not IsObj($oLanConnection) Then Return SetError(3, 0, 0) $oEnableVerb = "" $oDisableVerb = "" ; Find the state of the network connection. For $Verb In $oLanConnection.Verbs If $Verb.Name = "En&able" Then $oEnableVerb = $Verb If Not IsObj($oEnableVerb) Then Return SetError(5, 0, 0) $State = 0 EndIf If $Verb.Name = "Disa&ble" Then $oDisableVerb = $Verb If Not IsObj($oDisableVerb) Then Return SetError(5, 0, 0) $State = 1 EndIf If $Verb.Name = "Re&pair" Then $oRepairVerb = $Verb If Not IsObj($oRepairVerb) Then Return SetError(5, 0, 0) EndIf Next ; Return State If $iFlag = 4 Then Return $State ; Repair Net Connection ElseIf $iFlag = 3 And $State = 1 Then $oRepairVerb.DoIt ; Toggle Net Connection ElseIf $iFlag = 2 Then If $State = 1 Then $oDisableVerb.DoIt Else $oEnableVerb.DoIt EndIf ; Enable Net Connection ElseIf $iFlag = 1 And $State = 0 Then $oEnableVerb.DoIt ; Disable Net Connection ElseIf $iFlag = 0 And $State = 1 Then $oDisableVerb.DoIt ; Else there is an error Else Return SetError(5, 0, 0) EndIf ; Loop to wait change state (for changing state of more than one connection). $begin = TimerInit() While 1 $dif = Int(TimerDiff($begin) / 1000) If $dif > 10 Then ExitLoop ; Control the state of the NIC to exit before the end of waiting time. If $iFlag = 3 And _Nic_NetCCWin32($oLanConnection, 4) = 1 Then ExitLoop If $iFlag = 2 And $State = 1 And _Nic_NetCCWin32($oLanConnection, 4) = 0 Then ExitLoop If $iFlag = 2 And $State = 0 And _Nic_NetCCWin32($oLanConnection, 4) = 1 Then ExitLoop If $iFlag = 1 And _Nic_NetCCWin32($oLanConnection, 4) = 1 Then ExitLoop If $iFlag = 0 And _Nic_NetCCWin32($oLanConnection, 4) = 0 Then ExitLoop Sleep(100) WEnd ; Set the return value of the function. $Res = _Nic_NetCCWin32($oLanConnection, 4) If $iFlag = 4 And $Res = 1 Then Sleep(3000) Return 1 ElseIf $iFlag = 1 And $Res = 0 Then Return 0 ElseIf $iFlag = 0 And $Res = 1 Then Return 0 Else Return 1 EndIf EndFunc ;==>_Nic_NetCCWin32 Func _Nic_NetCCWin32New($oLanConnection, $iFlag = 1, $iFullName = 1); Only for Vista/W2K8 Local $objWMIService, $colItems, $iModState = 0 $objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", 0x30) If Not IsObj($colItems) Then Return SetError(4, 0, 0) ; Change NIC state of $oLanConnection ; Check name of the connection For $objItem In $colItems If $objItem.NetConnectionID = $oLanConnection Then ; Check State. If $iFlag = 4 Then If $objItem.NetEnabled = True Then Return 1 Else Return 0 EndIf Else ; Change the State of Net Connection. ; Disable Net Connection If $iFlag = 0 And $objItem.NetEnabled = True Then $objItem.Disable ; Enable Net Connection ElseIf $iFlag = 1 And $objItem.NetEnabled = False Then $objItem.Enable ; Toggle Net Connection ElseIf $iFlag = 2 Then If $objItem.NetEnabled = True Then $objItem.Disable $State = 1 Else $objItem.Enable $State = 0 EndIf EndIf ; One change be done. $iModState = 1 EndIf ExitLoop EndIf Next ; If no connection then error. If $iModState = 0 Then Return SetError(3, 0, 0) ; Loop to wait state change. If $iFlag = 4 Then While $iFlag <> _Nic_NetCCWin32New($oLanConnection, 4) Sleep(250) WEnd Else Sleep(1000) If $iFlag = 2 Then If $State = 0 And _Nic_NetCCWin32New($oLanConnection, 4) = 1 Then Return 1 ElseIf $State = 1 And _Nic_NetCCWin32New($oLanConnection, 4) = 0 Then Return 1 Else Return 0 EndIf ElseIf $iFlag = 1 And _Nic_NetCCWin32New($oLanConnection, 4) = 1 Then Return 1 ElseIf $iFlag = 0 And _Nic_NetCCWin32New($oLanConnection, 4) = 0 Then Return 1 Else Return 0 EndIf EndIf EndFunc ;==>_Nic_NetCCWin32New Func _DriveMap() DriveMapDel("P:") DriveMapDel("S:") DriveMapAdd("S:", "\\share1$", 1) DriveMapAdd("P:", "\\share2$", 1) EndFunc ;==>_DriveMap I could probably clean up the ping, drive mapping check, and the "checkmark" actions but I'll have to do some research on it first. I also need to tap into AD in order to check a users home folder instead of going by what the @homeshare is but that's for a later date. -
Display multiple WMI variables in GUI
PnoT replied to PnoT's topic in AutoIt General Help and Support
Wow, you completely nailed this for me!! I've not only got exactly what i wanted but you've also taught me how to setup the array and pull the info that i need. I was missing that part and couldn't quite wrap my head around it. Maybe you can shed some light on a new delima While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $SL _SLFIX() Case $MD _DriveMap() Case $DA ;;not used yet Case $Exit Exit EndSwitch WEnd EndFunc ;==>_RenderGUI I have the script check for mapped drives and if they are correct (drive is mapped properly) then i put a small green check mark next to the drive mapping to indicate all is good. If the mapping is not correct I can hit a button I've created called "Map Drives" and it calls the _DriveMap() function above. My only problem is I would love to have the gui go back and check the mappings again and put a checkmark on them after the _DriveMap() function is finished. How is that accomplished exactly? -
I'm building a GUI tech support tool for our users and I'm pretty new, compared to other, to AutoIT and would appreciate some help. Here is what i have so far: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=h:\autoit3\autoit scripts\form1.kxf $Form1_1 = GUICreate("MYIT Support Tool", 500, 497, 275, 216) $Group1 = GUICtrlCreateGroup("Computer Status", 8, 8, 330, 481) $Label1 = GUICtrlCreateLabel("IPs:", 26, 31, 26, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label10 = GUICtrlCreateLabel(@IPAddress1 & " - " & @IPAddress2 & " - " & @IPAddress3 & " - " & @IPAddress4, 60, 32, 260, 21) ;--- Ping results section--- $Label3 = GUICtrlCreateLabel("Ping Status", 24, 96, 69, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Server", 32, 128, 41, 17) $ping = ping("server3",250) If @error = 0 Then GUICtrlCreateLabel("OK", 110, 128, 22, 21) Else GUICtrlCreateLabel("FAILED", 110, 128, 22, 21) EndIf $Label4 = GUICtrlCreateLabel("Server2", 32, 152, 59, 17) $ping2 = ping("lasadserv2",250) If @error = 0 Then GUICtrlCreateLabel("OK", 110, 152, 22, 21) Else GUICtrlCreateLabel("FAILED", 110, 152, 22, 21) EndIf ;--- Computer Information Section--- $Label5 = GUICtrlCreateLabel("Information", 24, 216, 67, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label6 = GUICtrlCreateLabel("User:", 32, 256, 29, 17) $lable11 = GUICtrlCreateLabel(@LogonDomain & "\" & @UserName, 130, 256, 200, 40) $Label7 = GUICtrlCreateLabel("Computer Name:", 32, 288, 83, 17) $lable12 = GUICtrlCreateLabel(@ComputerName, 130, 288, 200, 40) $Label8 = GUICtrlCreateLabel("Domain Controller", 32, 320, 87, 17) $lable13 = GUICtrlCreateLabel(@LogonServer, 130, 320, 200, 40) $Label9 = GUICtrlCreateLabel("Home Folder:", 32, 352, 67, 17) $lable14 = GUICtrlCreateLabel(@HomeShare, 130, 352, 200, 40) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd This is two screenshots of what i would like to see. The way it is now: How i would like it to look: I would like to be able to use some of the output variables ($objItem.Description) and put those under where the "IPs" are instead of using @IPAddress1-4 but I can't figure out how to accomplish that when there are more than 1 adapter on a machine as it displays just the last adapter name in the loop. Here is some code i found by one of the members and is what i'm trying to use in order to pull the information. $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled != 0", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $strDefaultIPGateway = $objItem.DefaultIPGateway(0) $Output = $Output & "DefaultIPGateway: " & $strDefaultIPGateway & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "DNSDomain: " & $objItem.DNSDomain & @CRLF $Output = $Output & "DNSHostName: " & $objItem.DNSHostName & @CRLF $strIPAddress = $objItem.IPAddress(0) $Output = $Output & "IPAddress: " & $strIPAddress & @CRLF $Output = $Output & "IPEnabled: " & $objItem.IPEnabled & @CRLF $strIPSubnet = $objItem.IPSubnet(0) $Output = $Output & "IPSubnet: " & $strIPSubnet & @CRLF $Output = $Output & "MACAddress: " & $objItem.MACAddress & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_NetworkAdapterConfiguration" ) Endif
-
This script does not work at all. H:\AutoIt3\Include\3c_networKer.au3 (213) : ==> Array variable subscript badly formatted.: $_net_nics [$_IP_to_move][$_jj] = $_net_nics [$_IP_from_move][$_jj] $_net_nics [$_IP_to_move][$_jj] = $_net_nics [^ ERROR
-
I've tried FileInstall with no luck. I know for a fact it is incorporating the .dll into the exe as the file size increases according to how much the .dll is. I took a look at the loading the dll into memory but i'm not sure on how to get this into the script. Do i use this method to insert into my main script or does this go into the 7zip.au3 include file. Sorry to be a pain but i'm still learning.
-
This is exactly how the original script is setup. I have it running right now but I want to know if there is a way to incorporate the actual 7-zip32.dll file into the compiled exe and have it run. The compiled exe will only work if the .dll is in the proper location on the target machine.
-
I'm having the same issue as you and I have also used the dll in the first post and the 3.0.11 version with no luck. *EDIT* The issue is the 7zip.au3 not being able to find the .dll. You can test this by putting your script, the 7zip.au3, and the .dll in the same folder. Everything works like a charm. The only problem I'm having now is when i compile my script and run it elsewhere it can't find the .dll file even thou I've used "FileInstall" and specified to incorporate it into the .exe.
-
I'm using the latest SevenZip.au3 (0.4.5) and Multiple_zip.au3. I'm running Multiple_zip.au3 and selecting a folder to archive but nothing in that folder is being added. There are 2 .exe files and nothing else.
-
For those people that use Gmail you can add the ssl port onto the end of your smtp server like so: smtp.gmail.com:445 Is there anyway to make a drag n drop feature so you can drag a file from explorer onto the mailer window and have it auto attach?
-
Enumerate Registry & Uninstall software via Uninstall String
PnoT replied to PnoT's topic in AutoIt General Help and Support
This is exactly what i was looking for thank you so much. The name match must be exact case but i can live with! -
I apologize in advance if this has been discussed before but I can't seem to find something that works to my specific needs. I can't find a script that will find software in the registry and automatically run the uninstall for it. I found this piece of code but it replies with a "success" no matter if the software is installed or not. I've tried to modify it to report correctly with no luck so far. Func WMIService($host) ;Connects to WMI Service $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $host & "\root\cimv2") If not IsObj($objWMIService) Then return 0 return $objWMIService EndFunc Func WMIQuery($objWMIService,$strWMIQuery) ;Perform WMI Query with Query String and Data Return Parameters $colItems = $objWMIService.ExecQuery($strWMIQuery) For $objItem in $colItems ;MsgBox(0,"asdasd",$objitem.name) $objItem.Uninstall() Next return 1 EndFunc $objWMIService = WMIService("localhost") ;WMIService Object - Establish Connection If $objWMIService = 0 Then Exit ;~ $objWMIService1 = WMIService("localhost") ;WMIService Object - Establish Connection ;~ If $objWMIService1 = 0 Then Exit $soft1 = WMIQuery($objWMIService,"Select * from Win32_Product Where Name like '%Photoshop%'") If $objWMIService = 0 Then MsgBox(0,"Error","An error have accured") Exit EndIf $objWMIService = 0 MsgBox(0,"Success","Uninstall compleeted successfully")
-
I just figured out what was going on and why all my dos windows were not staying up when needed and the commands were not running. My system32 folder on my machine had its rights changed probably due to me having some problems a month or so ago. The permissions on the utils i was trying to run were not visible from dos and did not have full control for admins set. Thanks for the help and I was able to kill 2 birds with one stone this trip =-)
-
I can never get the dos window that AutoIT spawns to issue the command to stay open for viewing. It closes immediately and I've had that problem on any script I've ever ran that referenced a dos command. What am i doing wrong for the window to close like it does?
-
I've tried this so many ways my head is hurting. Could someone point me in the right direction as to why this code is not working properly? Run(@ComSpec & " /c " & 'dfsutil.exe /root:\\sample.com\ud$ /export:c:\temp\Namespace.txt',"",@SW_HIDE)
-
psexec and passing variables to the command line
PnoT replied to PnoT's topic in AutoIt General Help and Support
That fixed things for me! Thank you very much for the assistance and super quick response. You've gotta love a forum where a developer takes the time out of his/her busy schedule to lend a helping hand. -
psexec and passing variables to the command line
PnoT replied to PnoT's topic in AutoIt General Help and Support
I ran the code that you've posted but now the powershell.exe is not showing up on the remote server as a process anymore so it's acting like no execution is being done. -
I'm trying to get this script to run a powershell command on a remote server so i can give executive admins in our company an easy way to setup anyone with out of office. I believe I'm passing the input variables wrong at the end because i have verified the script launches the powershell.exe on the remote system. The arguments for the powershell script are: PowerShell.exe <pathToScript>\set-OOf.ps1 <Primary SMTP Address of User> OOf Message (notice the ' ' on the last argument) Here is my script so far... $email = InputBox("Out of Office Tool", "Email address of employee?") $message = InputBox("Out of Office Tool", "Message to be displayed in Out of Office Message?") run("psexec \\servername -d -u username -p password -w c:\oofscript\ ""powershell.exe c:\oofscript\set-oof.ps1"" & $email & $message")
-
Smtp Mailer That Supports Html And Attachments.
PnoT replied to Jos's topic in AutoIt Example Scripts
Is there a way to have this program attach whatever file you want just by dragging it onto the .exe?