Using PowerShell to look up USCF member info
If you are one of the chess players who play rated USCF (United States Chess Federation) games, you may have used their look up tool to find someone’s rating and other details, or may be your own after you completed a tournament.
Being a PowerShell geek, I had to figure out how can I fetch the same information using script or a function. Now that I have it, I’m sharing it here with you.
For those of you who have nothing to do with Chess, you may still want to look at the script to learn few cool thing like using objects and adding properties to a custom object, using post method to retrieve data from a webpage using values defined in a variable and using comment based help in your script file.
Here’s what the script does:
Aoccepts input in form of Lastname, Firstname and wildcard. Lastname is required, firstname and wildcard are optoinal.
- Accepts input in form of USCF ID. Step 1 and 2 are mutually exclusive. You can only use one or the other.
- Checks if computer is connected to internet. We can’t fetch data from internet otherwise, can we?
- Validates all variables and fetches USCF member data as per the query if no errors found in validation.
- Allows output to be sent to csv file using –OutFile parameter. Output to console is suppressed if sent to file.
For brevity, I am not posting code in the post. You can download the file here.
Originally posted at http://blogs.technet.com/bshukla