ZipleR
Active Members-
Posts
29 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
ZipleR's Achievements
Seeker (1/7)
0
Reputation
-
ZipleR reacted to a file:
AD - Active Directory UDF
-
Array Loop while deleting elements
ZipleR replied to ZipleR's topic in AutoIt General Help and Support
So glad I asked.. That is WAY easier than I was making it... Thank you! -
Every time I need loop through an array and remove elements I run into issues.. Can anyone help me understand a good way to loop through an array, remove elements and NOT crash due to ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: Here is some sample code that I have to show you the type of loop I am talking about. Local $bResult[1], $aResult[6] = ["5","Item1","Item2","Item3","Item4","*Item5"] ;Loop through an array and remove any element starting with "*" For $x = 1 to $aResult[0] ;starting $x at 1 to skip the Array Size row [0]. If StringLeft($aResult[$x],1) = "*" then ; This will test if item $x in the array starts with "*" $bResult[0] = _ArrayAdd($bResult,$aResult[$x]) ;if it does, Add it to a second array and store the Array size in $bResult[0] $aResult[0] = _ArrayDelete($aResult,$x);remove the element from the array and store the new array size in $aResult[0] $x -= 1 ;This will lower $x by one so the next time through the element that moved up will be tested EndIf Next _ArrayDisplay($aResult, "Source") ;Display what was in the source array _ArrayDisplay($bResult, "Destination") ;Display what was moved to the destination array. Any advice would be much appreciated. Thank you!
-
Ideas for storing large amount of device data
ZipleR replied to ZipleR's topic in AutoIt General Help and Support
Ok... Finally.... I have been working in the SQLite GUI thing since last night trying to get a database to work with 1 Main table, and 7 linked tables,... I could not get it working no matter what I tried. I even tried to build just a simple 2 table database and link them together with no succeess.... No matter what I tried I would get an error indicating "foreign key mismatch" After just about giving up I took the DDL code from the 3 table database that jchd created and used it as a template to manually create the database table structure that I want and finally got it working! Now the next step is to get a connection from Autoit to the database and sucessfully query and store something into it... Once I get that working I hope I wont have much of a problem updating my existing functions to store into the database instead of the INI files. Thanks for everyones help and suggestions! I will let you know when I get past the next step. -
Ideas for storing large amount of device data
ZipleR replied to ZipleR's topic in AutoIt General Help and Support
jchd: Thank you for the example and recommendation. I will download SQLite Expert right now and take a look at the database. I will then see if I can get a AutoItScript to connect to it and add/return what I am looking for. Just curious - If I have 8 Processes connecting to the database retrieving data once every 5 minutes, and potentially 5 seperate processes randomly adding data (mostly adds, with rare updates and even less removals) do you see a problem with SQL Lite? Like I was saying - I had it working with INI files, and now SQLLite is going to add a different dynamic that I wasn't planning for. I will let you know when I get something working! Thanks again! -
Hello, I have been working on a script to gather a bunch of network device data and storing it in an INI file. I have it working for what I was trying to do, however I now hit the limit of 32767 characters, so there is no way I am going to be able to store information on 10,000+ devices in an INI file. I had, by mistake thought that the 32767 limit was per section - not the whole file. Does anyone have any suggestions on how I could store a large number of records in a human readable file? A SQLLite database may be an option, but I do not have much SQL exposure, so building queries to extract the data I am looking for would be challenging. Here is an example of a section that I am storing... [ExampleList] ExampleDevice=DeviceName;IPAddress;Maker;Model;Serial;FWVersion;Driver;Modified I create Single array to handle this by doing this $Array = BuildArray() Func BuildArray() $Local = IniReadSection($ConfigPath,"PrinterList") $x = $Local[0][0] +1 ReDim $Local[$x][9] For $x = 1 to $Local[0][0] $Temp = StringSplit($Local[$x][1],";") $Local[$x][1] = $Temp[1] $Local[$x][2] = $Temp[2] $Local[$x][3] = $Temp[3] $Local[$x][4] = $Temp[4] $Local[$x][5] = $Temp[5] $Local[$x][6] = $Temp[6] $Local[$x][7] = $Temp[7] $Local[$x][8] = $Temp[8] Next Return($Local) EndFunc .... Like I said, the above works just fine, however an INI file with the built in INI functions are just not going to cut it as I can only store about 300 devices worth before reaching the character limit. Any ideas or suggestions would be appreciated. Thanks!
-
Retrieve "Self Set" Environment Variable
ZipleR replied to jwc's topic in AutoIt General Help and Support
And your point? -
I am having a hard time checking the existence of Printer shares. It seems to me that the Printer name in _Net_Share_ShareCheck(Server,Printer) is case sensitive. Can anyone think of a workaround for this? I was having Problems on 3.3.6.1 and just upgraded to 3.3.8.1 because it mentioned a fix to this UDF. Here is a simple script so someone else can test this and see what I am talking about. #Include <NetShare.au3> #Include <Array.au3> Dim $keepLooping = 1, $Input1 = "", $Input2 = "" While $keepLooping = 1 $Input1 = InputBox("Server","Enter Server Name",$Input1) If @error then ExitLoop $Input2 = InputBox("Printer","Enter Printer Name",$Input2) If @error then ExitLoop $Result = _Net_Share_ShareCheck($Input1, $Input2) If $Result = $STYPE_PRINTQ then MsgBox(0,"Info", "It is a print queue") Else MsgBox(0,"Booo", "It is not a print queue") EndIf WEnd Exit------
-
Firstly - I have to say you have a huge amount of functions built into this and must be a scriptaholic.... Nice work. Before you start attending SAA, would you be able to add any terminal services API's? Specifically WTSEnumerateSessions? Here's a list I found from Microsoft of functions they support. Terminal Services API Functions The following functions are used with Terminal Services. ProcessIdToSessionId VirtualChannelClose VirtualChannelEntry VirtualChannelInit VirtualChannelInitEvent VirtualChannelOpen VirtualChannelOpenEvent VirtualChannelWrite WTSCloseServer WTSDisconnectSession WTSEnumerateProcesses WTSEnumerateSessions WTSFreeMemory WTSLogoffSession WTSOpenServer WTSQuerySessionInformation WTSQueryUserConfig WTSSendMessage WTSSetUserConfig WTSShutdownSystem WTSTerminateProcess WTSVirtualChannelClose WTSVirtualChannelOpen WTSVirtualChannelPurgeInput WTSVirtualChannelPurgeOutput WTSVirtualChannelQuery WTSVirtualChannelRead WTSVirtualChannelWrite WTSWaitSystemEvent ProcessIdToSessionId Thanks! And hope you consider adding a few of these..
-
WTSEnumerateSessions API in AUTOIT ?
ZipleR replied to Yogui's topic in AutoIt General Help and Support
I just created this using WMI and it seems to work on Windows 7 and Server 2008. It does not work on Server 2003. Dim $result$ WMI = ObjGet("winmgmts:" & @ComputerName & "rootcimv2") ;connect to WMI on computer $query = $WMI.ExecQuery("SELECT * FROM Win32_TerminalService") ;query remote machine For $element in $query $result = "Sesstions:" & $element.TotalSessions -2 & Chr(13) ;Subtracts 2 Console(s) - Only Counting RDP Sessions Next MsgBox(0,"Restult",$result) I read that TerminalService is a Subclass of Win32_Service. However, I can not get Win32_Service to pull anything from TermService... So - now I have 2 options. 1) Get the DLL call to work (Which is my preferred method) 2) Get the WMI Query working with Win32_Service. Thanks! -
WTSEnumerateSessions API in AUTOIT ?
ZipleR replied to Yogui's topic in AutoIt General Help and Support
Ok. PSaltyDS - You are Right.... I am stumped on the DLL calls... Does anyone have a working example that returns the number of Terminal Server Sessions? ---------------- DllOpen("Wtsapi32.dll") The Function in the DLL that I want to use is WTSEnumerateSessions (or WTSEnumerateSessionsEx) The Parameters for WTSEnumberateSessions are below hServer [in] A handle to an RD Session Host server. Specify a handle opened by the WTSOpenServer or WTSOpenServerEx function, or specify WTS_CURRENT_SERVER_HANDLE to indicate the RD Session Host server on which your application is running. Reserved [in] This parameter is reserved. It must be zero. Version [in] The version of the enumeration request. This parameter must be 1. ppSessionInfo [out] A pointer to a variable that receives a pointer to an array of WTS_SESSION_INFO structures. Each structure in the array contains information about a session on the specified RD Session Host server. To free the returned buffer, call the WTSFreeMemory function. To enumerate a session, you must have Query Information permission. For more information, see Remote Desktop Services Permissions. To modify permissions on a session, use the Remote Desktop Services Configuration administrative tool. To enumerate sessions running on a virtual machine hosted on a RD Virtualization Host server, you must be a member of the Administrators group on the RD Virtualization Host server. pCount [out] A pointer to the variable that receives the number of WTS_SESSION_INFO structures returned in the ppSessionInfo buffer. I think I need to build a structure to access only pCount when using DllStructGetData? -
I have to admit... The example pictures that you have look pretty cool. I am just having a hard time figuring out an example of how these functions can be used. (I have not downloaded your example yet... just read the function names) I use Excel to make Graphs for Citrix Servers with 2 lines... One line for User Sessions, another line for Either CPU, Memory, Disk Busy time, etc... (Each graph Separate). I am guessing it could be used to do something simple like that if you can make fossilized fish.. When I have a chance I will see what I can do. Thanks!
-
[Solved] Run simple command line apps on 64Bit server
ZipleR replied to ZipleR's topic in AutoIt General Help and Support
Yeah. I thought it was maybe some type of security built into windows. We use McAfee, and there was nothing being logged in the logs relating to it... -
[Solved] Run simple command line apps on 64Bit server
ZipleR replied to ZipleR's topic in AutoIt General Help and Support
Ok... I figured this out by using ProcMon. The 64bit WOW redirection was messing with the search path for shell commands. (as well as registry changes) I was having the same problem when trying to copy files to the System32 folder using a batch file on other 64 bit servers a while back. To fix it in Autoit - do the following to disable Wow64DisableWow64FsRedirection Dim $ServerList[5]=[4,"Server1","Server2","server3","Server4"] $Result = ForceReboot($serverList);Calls Function passing Array of Servers. Exit Func ForceReboot($LocalList) If $LocalList[0] > 0 then ;If the list of servers is blank - skips this function. For $y = 1 to $LocalList[0] ;Loops through list of servers DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1);Turns off 64 bit redirection Run ('Shutdown /r /f /t 600 /d p:4:1 /c "Weekly Scheduled Reboot" /m \\' & $LocalList[$y],@SystemDir ) DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 0);Turns 64 bit redirection back on Next ;Goes to the next server in the list Return(1) ;Returns 1 for Success Else Return(0) ;Returns 0 for Failure EndIf EndFunc -
Hey everyone... I am trying to build a script to manage a Citrix farm. I do not want the script to sit on each server, so I have it stored on a network share. The script has several functions built in that call command line tools such as msg.exe, shutdown.exe, schtasks.exe, etc... I am having a problem where the run command is not firing off the tools I am calling - or the execution is being blocked somehow. Below is one of the functions that I have created which is not working. I have tried the @ComSpec & " /c, and even captured the output (which is blank as expected). I did take the Command string (after Run) and place it into a input box so I could select and copy exactly what is being "Run", and the command that was in the input box works as expected when pasted into a command window. The $LocalList is being passed from a different function that selects the appropriate servers - so in the example below I just created a generic array of servers. Please let me know if you have any ideas. The script is running on Server 2003R2 x64. Dim $ServerList[5]=[4,"Server1","Server2","server3","Server4"] $Result = ForceReboot($serverList);Calls Function passing Array of Servers. Exit Func ForceReboot($LocalList) If $LocalList[0] > 0 then ;If the list of servers is blank - skips this function. For $y = 1 to $LocalList[0] ;Loops through list of servers Run ('Shutdown /r /f /t 600 /d p:4:1 /c "Weekly Scheduled Reboot" /m \\' & $LocalList[$y],@SystemDir ) Next ;Goes to the next server in the list Return(1) ;Returns 1 for Success Else Return(0) ;Returns 0 for Failure EndIf EndFunc
-
UEZ: Thanks for the code... Unfortunately, I can not get this to work recurrsively... I did not want to run this against my entire c:\, so I created a c:\2 folder. In there I created Several Sub Folders, and Additional Sub Folders below that. When I run this script against the c:\2\ folder it only returns 1 file from the c:\2\ folder, and nothing else. (Should return 3 files from each folder) Problem is, I dont see in the code where the problem might be... ------------------------------------------------------------ Just figured it out. The Version of AutoIt I am using is 3.2.2.0... Somewhere between 3.2.2.0 and 3.3.2.0 the FileFindNext function changed and now sets @extended.. Thanks! (I could cancel the post, but maybe it will help others.)