im writing an a Login Script that gets some Computer Information and pushes the Information to a SQL Express Database, every time a user logs on to the System
So I can grab the Information with Excel or another frontend and sort it by Computername or OU or something else.
- At first, I generate a small Report
- Check if the Hostname is already in my Database (function New-SQLCheck) If it is, update (function New-SQLUpdate) This is where I need help. if not create a new entry. (function New-SQLInsert)
This is working at the Moment, but the script takes very long to process and I think it s not really professional coded( I´m no programmer, but I learn fast )
Is it possible that you look over my Code and give me advise specially for the part where I UPDATE a hostname?--> UPDATE INVENTORY SET OSName='OBject1" 'Object2' 'Object3' ect..
I want to update the complete array of my Report@() instead of updating every single Object, ´cause in the feature there are coming more and more objects that we want to push.
I hope you see what I mean
Here are the neccessary parts of my code
You said that I open a connection for every set to process but I think I dont...but correct me if Im wrong.
- I´m creating my Report- Open a Connection in my function New-SQLCheck- Check if 'Hostname' exists- then update or insert my Report. I open the connection only one time..?
Powered by IDERA