Batch to check Lockout Observation Window

Author Message
john3j04

  • Total Posts : 7
  • Scores: 0
  • Reward points : 750
  • Joined: 7/11/2012
  • Status: offline
Batch to check Lockout Observation Window Tuesday, July 17, 2012 11:29 AM (permalink)
0
Hello,
 
I was trying to figure out how to do a for statement that will store the value of the Lockout observation window in command line.  If you type net accounts | findstr /b /c:"Lockout observation window (minutes)" into command prompt it will show you what your lockout window is set to.  I am basically trying to figure out how to create a check that stores the value in a variable, then compare it to a set number and display pass or fail.  If anyone could help me it would be greatly appreciated!
 
Thanks,
John
 
#1
    ndaniels

    • Total Posts : 132
    • Scores: 45
    • Reward points : 21680
    • Joined: 2/24/2006
    • Location: The Republic of Elbonia
    • Status: offline
    Re:Batch to check Lockout Observation Window Tuesday, July 17, 2012 11:35 AM (permalink)
    5
    How about...
     
    for /f "tokens=5" %%a in ('net accounts ^| findstr /i /b /c:"Lockout observation window (minutes)"') do set LockOutObs=%%a
     
    #2
      john3j04

      • Total Posts : 7
      • Scores: 0
      • Reward points : 750
      • Joined: 7/11/2012
      • Status: offline
      Re:Batch to check Lockout Observation Window Wednesday, July 18, 2012 6:35 AM (permalink)
      0
      This worked!  I had tried something similar to this before, but what is different is the tokens= part.  I gues I didnt really understand what that part meant.  Thank you for your help!
       
      #3
        ndaniels

        • Total Posts : 132
        • Scores: 45
        • Reward points : 21680
        • Joined: 2/24/2006
        • Location: The Republic of Elbonia
        • Status: offline
        Re:Batch to check Lockout Observation Window Wednesday, July 18, 2012 9:36 AM (permalink)
        0
        Not a problem!  Glad it worked!  The tokens indicates the number of the "fields" as delimited by whatever is specified as "delims=x".  If you omit the delims parameter (as I did), blank space is the default delimiter.  The number you wanted to pull from the "net accounts" command and assign to a variable was the fifth "token" in the text output.  Let me know if that doesn't make sense.  As another example, you could use "tokens=1-4 delims=," if you were processing a CSV file and wanted to work with the first four tokens.  Those tokens would become %%a, %%b, %%c, %%d.
         
        #4
          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2013 ASPPlayground.NET Forum Version 3.9