Trouble with multiple Device ID's (Local Hard drives)

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Trouble with multiple Device ID's (Local Hard drives)

Post by jvierra »

It updates every record for a server. It does not work as you think which you may eventually see.
User avatar
mtartaglia
Posts: 101
Last visit: Mon Dec 19, 2022 11:45 am

Re: Trouble with multiple Device ID's (Local Hard drives)

Post by mtartaglia »

I want it to update every record. I am only updating what is in the view. The view only shows entries for ENDTIME, ENDDATE and ENDSPACE(Free disk space) that are NULL. This is exactly what I need. The script is only meant to run twice a day. Once for the START switch and once for the END switch. I will run it for a few days and report back to you if you like.

Thanks again! :)

Mike
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Trouble with multiple Device ID's (Local Hard drives)

Post by jvierra »

But you will update every deviceid with the values for the last device ID. If there is only one device per server then this will not be obvious. You have never said you are updating a view that filters old records. THat will still fail if you miss an end of day update. Add Date intot he key and this can be prevented.

The key needs to be "Server+DeviceID+Date". If this is set as the primary key then you will not be able to corrupt the table with duplicate entries for a day.
User avatar
mtartaglia
Posts: 101
Last visit: Mon Dec 19, 2022 11:45 am

Re: Trouble with multiple Device ID's (Local Hard drives)

Post by mtartaglia »

2018-01-03_12-37-39.png
2018-01-03_12-37-39.png (41.67 KiB) Viewed 1713 times
See attached image to see what I was going for. I did a few tests that created this data.

However, I agree with you about the the primary key should be more than just the ID field. I will work on that. Thanks again!

Mike
This topic is 6 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked