Writing a powershell script need help
Budget: $10 – $30 USD
Problem to solve:
I have a list of animals in a text file. called animallist.txt
I need a script to be able to monitor this file for changes on an hourly basis.
when I modify this list, add or remove an animal and I run the script on demand it needs to tell me what I modified.
I have this so far:
#Get contents of the file
$list = Get-Content .\Desktop\animallist.txt -Raw
#Dispaly contents
$list
#if file changed then do ????
if ($list -gt 3)
if name added then write-host "Sheep was added to the animal list"
if name removed then write-host "Cat was removed from the animal list"
I can find how in PowerShell you track changes to the files in the folder
But I do not know what syntax to use to track changes inside the text file itself.
And the script can not have any dependent libraries
help is highly appreciated.
Thank you
I have a list of animals in a text file. called animallist.txt
I need a script to be able to monitor this file for changes on an hourly basis.
when I modify this list, add or remove an animal and I run the script on demand it needs to tell me what I modified.
I have this so far:
#Get contents of the file
$list = Get-Content .\Desktop\animallist.txt -Raw
#Dispaly contents
$list
#if file changed then do ????
if ($list -gt 3)
if name added then write-host "Sheep was added to the animal list"
if name removed then write-host "Cat was removed from the animal list"
I can find how in PowerShell you track changes to the files in the folder
But I do not know what syntax to use to track changes inside the text file itself.
And the script can not have any dependent libraries
help is highly appreciated.
Thank you