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)
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
|
|
|
|
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)
How about... for /f "tokens=5" %%a in ('net accounts ^| findstr /i /b /c:"Lockout observation window (minutes)"') do set LockOutObs=%%a
|
|
|
|
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)
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!
|
|
|
|
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)
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.
|
|
|
|