Improving Read-HostSpecial

Jana Sattainathan makes Jeff Hicks’s Read-HostSpecial better:

Some shortcomings of Read-HostSpecial

While it does a lot already, I did find some very minor shortcomings that I wanted to address

  1. Bad inputs killed the program – If you are prompting for a series of inputs (like a wizard) and the user mis-keyed one input by mistake, the error recovery is very hard and the user has to start-over from the beginning. This called for a RepromptOnError switch which issues a gentle warning and then allows the user to input a valid value upon encountering validation errors.

  2. I needed a couple of more canned validations like ValidateFolder and ValidateFile.

  3. Too bad, there is no Write-HostSpecial – I wanted Read-HostSpecial to display some pretty text and not wait for input (like Write-Host) using the same nomenclature for fonts/look/feel/usability as Read-HostSpecial. So, I needed a NoWait switch.

Read on for Jana’s script and usage examples.

Related Posts

Navigating A SQL Server Instance With Powershell

Andy Mallon shows off the drive-based navigation available in the SQL Server Powershell module: I recently noticed that the system objects were missing from my results when I do a Get-ChildItem. I noticed it with views, but then realized that none of the system objects showed up. What gives? I floundered through a quick Google search, […]

Read More

Find And Replace Stored Procedure Code

Jana Sattainathan has to find and replace a lot of code: The database has 100’s of stored procedures (700+ to be somewhat precise) Qualifying stored procedures have these characteristics Procedure name ends with “_del” Procedure has the string “exec” in the code Procedure has the string “sp_execute” in the code This is what needs to […]

Read More

Categories

April 2017
MTWTFSS
« Mar May »
 12
3456789
10111213141516
17181920212223
24252627282930