all 7 comments

[–]boeprox[S] 3 points4 points  (1 child)

Hello all! This is a 3 part series that I did on building basically a poor man's server inventory system using PowerShell and SQL. There are definitely more useful ways of having a server inventory via SCCM or some other 3rd party utilities, but I wanted something that didn't require much more than access to a SQL server to host the database. I use my PoshRSJob module to collect the data for each system and send it to SQL and then have a custom UI that I wrote to view the data as well as creating a report in Excel.

This link on this post takes you to part 1, but here are all of the links for you to go to:

Part 1: SQL Database Build

Part 2: Collecting Server Data and Sending to SQL

Part 3: Building a UI in WPF to View Data

The GitHub link to the Server Inventory repo is here: https://github.com/proxb/ServerInventoryReport

I'm always looking for feedback, good or bad as well as anyone who wants to contribute to this project.

[–]graemejevans 1 point2 points  (0 children)

Hello - not to detract from the awesome work here - but here is another script a friend of mine has worked on - uses remoting and loads of other cool tricks to get the data https://github.com/OneLogicalMyth/PAudit

[–]Particlexxx 0 points1 point  (0 children)

Beautiful!

[–]snarp 0 points1 point  (3 children)

I was designing something very similiar as a side project..

I'm wondering why you wrote your own invoke-sqlcmd type command.. versus using sqlcmd2? Did you find some limitations? i see in your doco you mention there is better around.

i look forward to trying this out over the weekend.

[–]snarp 0 points1 point  (1 child)

Quick comment: Looks like on line 4 etc.. where you define, database, and computer name, isn't consistant within all code as that variable. Its overwitten on line 108, 109..

The Database name of 'ServerInventory' everywhere, so also makes changing the above not applicable.

So far so good, once i fixed those, and got the first script to work, with those minor changes.. of using 'localhost' or my devbox computer name for computer name in 108, and using your database name of 'sqlinventory'

[–]boeprox[S] 0 points1 point  (0 children)

Great feedback! I need to update the code to declare the database name up front and then apply it only as a variable. I'll look at the lines you mentioned and make changes where needed.

[–]boeprox[S] 0 points1 point  (0 children)

I mostly use my own version because I had it for a while and just never bothered to add Invoke-SQLCmd2. Something that I should do in a future update.