Hi all,
I am after some advice from the community with regards to how best handle the following Scenario:
In reference to the following Best Practices when writing PowerShell tools
*A Tool does one thing.
*Objects are the only form of pipeline output emitted.
I have written a tool to Insert data into a SQL Database via Invoke-SQLCMD (I am generalizing the code and removing a lot of it to protect identity)
$ComputerName = "ServerA"
$Geolocation = "ACountry"
Invoke-Sqlcmd -Database $Database -ServerInstance $ServerInstance -Query "Insert into Details(ComputerName, Geolocation) VALUES ('$ComputerName','$Geolocation')"
When this runs you get no feedback from PowerShell and I cant see anything I can use on the pipeline- but it certainly is adding data into the DB, so something is happening there… I am aware of new parameters with invoke-sqlcmd like -outputas but playing around with these gives me nothing.
How do I design the above so that it outputs objects… but also not adding any extra activities in the tool…