Jan 11, 2012, 2:58 AM
Post #1 of 3
Comparison and editing files script
I have a backup solution (TSM) which will run every weekend a script. This script will save a list of VM and VM are four lists (one week). For now my VM lists are filled by hand but I want to write a script that automatically fill in these files while balancing the load (load space, I mean GB of VMDK to save each week) at the option of additions and deletions VM.
At the moment I thought of something like this:
The script will take as parameters:
- A file containing a list of all VMs on the present below a week earlier
- The quantity of GB VMDK lists for each of the four (4 files as parameters)
The script will:
- Get the current list of all VM
- If there is no difference stop treatment
- If there is a difference, he will find:
* If it is a VM within it will remove it from the list and change the total size in GB of VMDK from its list
* If it is a VM in addition, it will add the machine name to the list including the smallest storage space to save
- If there was a change it will send an email
- If there was a change, it will update the list of total VM it will take a point of comparison when the next time the script
The list of VM in 4 files are in this form:
So the script should be able to delete the name of a VM and the comma that follows, and if such a VM to add it should add ",VMname".
In addition the command to list VM is PowerShell, right after there is no worries on that side.
Well, I'm not sure where to see, I do not know how to compare two files and to create versions for a VM within VM or more.
If all this talk to someone I'm interested.
In advance thank you,
P.S : Sorry for my english