Chapter 14. Adding database access
We’re going to step away briefly from the tools we’ve been creating and look at something you might want to add to your projects: reading and writing information from databases. For example, you may want to query a database for a list of computer names. Or perhaps you want to write the results from a function to a database. As we’re going to show you, PowerShell doesn’t even care what kind of database it is!
Accessing databases from PowerShell requires the use of pretty low-level .NET Framework technology. To simplify that for you, we’re going to offer you a script module that bundles all the .NET stuff into a couple of PowerShell advanced functions, which should look and work a lot like a native PowerShell command. You’ll need to either enter the appropriate code listings or download them from http://MoreLunches.com (find this book’s name or cover image, click it, and go to the Downloads section).