Akshay Chouksey
Akshay Chouksey

Reputation: 13

Powershell Scripting for multiple Entries updating According to current time

I am having some information in the text file. I have to fetch that content regularly and run the script every time to eliminate the past entries based on the current time. I have to match the entries with the current time and have to delete the whole entry that has past time in it. I don't want to remove the entries in the future time. Mentioning the entries down.


[MyFirstEntry_abc.hostname.address]
Name=Abc
Class=5
Section=A
hostname= First Host
Time = hh:mm:ss DD:MM:YYYY +11:00

Now if Time is in the future I want to keep the entry and if Time is in the Past I want to delete the entry in the file and the remaining entry should remain intact. I have considered the case of having N entries in the text file. Can you please help me to remove the past entries as I am not able able to match the entries and del them in the text file?

Upvotes: 0

Views: 35

Answers (0)

Related Questions