Jump to content

Tutungzone

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Tutungzone

  1. Water, Wondering if I can use your UDF for a simple function within a much larger script running as a service on laptop computers. The service is running as a user with limited admin rights to the domain. Within the service I am picking up locally logged on user and parsing to variable $CurrentUser1. From here I want to use this variable to query the domain as to if the user account is disabled (not locked). If queried user account is disabled do this, if not do this. Basically this is part of a service script I have been running to help satisfy PCI requirements regarding network access while connected to the wireless at work. We found a loophole in our authentication process that if the user uses local cached domain creds then attaches to our internal wireless network... they are able to get to any non-windows resources on the network. What this service does is identifies whether the user account is good, if not, delete local cached creds, and force logoff. I have been basing my service off windows resources, and have run into a snag where if the account is locked, the service deletes local cached creds and logs off, which is a burden to users that have active user accounts, but locked for whatever reason. Your UDF will help separate what is considered locked, and disabled. I would rather base this on an AD attribute, then a simple network query. Any help for this function will be appreciated.
  2. Not sure this is the best way to do this, but it appears to work as designed. I only made minor changes to the above, and the order... otherwise, the end result is what I was looking for. I will check back to see if anyone else has replied. If you are wondering what this is for... it runs as a process that runs all the time that is watching for other processes to see if they die. If they do die, they are restarted with this process. Opt("WinTitleMatchMode", 3) ;Match Window Title mode to be EXACT mode 3 Opt("TrayIconHide", 1) ;Hide Tray Icon While 1 ;Opens up a WHILE loop, with 1 as a constant, so it is infinite $count = 2 ;How many are suppossed top be running? $list = ProcessList("myprog.exe") ;Place in an array all processes named "myprog.exe" For $i = 0 To UBound($list) -2 ;Count items in array and store to variable -2 for Ubound restrictions Next If $i < $count Then Run(@ComSpec & " /c myprog.bat ", "C:TechScripts", @SW_SHOW) ;If count is less than $count variable start process WinKill("DeadWindow") ;Kill Dead Window Sleep (120000) ;Puts the script to sleep for 120 Seconds so it doesn't chew CPU power WEnd
  3. I have a very basic process that I wrote and have been running for years that has worked great, but times have changed as well as needs. Basically the script runs in a loop looking for a process and then if the process does not exist, it starts it and re-checks in a minute. While 1 ; Opens up a WHILE loop, with 1 as a constant, so it is infinite If Not ProcessExists("myprog.exe") Then WinKill("WindowName") If Not ProcessExists("myprog.exe") Then Run(@ComSpec & " /c MyBatch.bat ", "C:\TechScripts\", @SW_SHOW) Sleep (60000) ; Puts the script to sleep for 60 Seconds so it doesn't chew CPU power WEnd I have to add complexity to this code now as I have a need to watch for 2 of the same process. Thinking about this I will need to find the process and count how many, if less than 2 then execute the WinKill and ComSpec, on next check is still not 2, execute it again. Same loop, same delay, same process, just 2 now. My thought is that I need to create an array, or store into a variable the number of processes running as the process name. Something like: While 1 ; Opens up a WHILE loop, with 1 as a constant, so it is infinite $count = 2 $list = ProcessList("myprog.exe") For $i = 0 To UBound($list) -2 Next If $i < $count Then WinKill("DeadWindowName") If $i < $count Then Run(@ComSpec & " /c MyBatch.bat ", "C:\TechScripts\", @SW_SHOW) Sleep (60000) ; Puts the script to sleep for 60 Seconds so it doesn't chew CPU power WEnd I am not sure my logic is right here though. I know Ubound adds a number for each time it runs, so I am minus 2 to even the number to be accurate, however I am not sure the for loop will operate right in the while loop. Please help.
×
×
  • Create New...