Compare files and move cluster resource

Hi Guys!

I need a help or guidance to create this script.

I need to compare two excel files. This excel files contains clusters groups ( before and after).

If the new excel file is different from the old, i need to move the resources like the old one.

Any suggestions?

Thanks!

This is my start script to collect the initial status from cluster group and the owner.


<pre class=""lang:ps">
Import-Module failoverclusters
$clusters = Get-Content C:\Clusters\list.txt

foreach($cluster in $clusters)
{
$file = $cluster + ".txt"
Get-ClusterGroup -Cluster $cluster | Tee-Object C:\clusters\$file
}</pre>

The easiest and fastest way to do this would be to check the LastWriteTime value with Get-ChildItem and keep whichever file is more recent. Don’t even bother dealing with the contents of the file.

It doesn’t really matter if the contents of the new file are different from the old or not. If they are different, you want the new file. If they aren’t different, and you keep the new file, you will still have the same information. So, always keep the new file.

If you absolutely must deal with the contents of the file to make some specific comparisons or validate certain data, it will be much easier if you can get the files in CSV format rather than XLS. PowerShell can import data from an Excel file, but it’s a little complicated (and in my experience, finicky). By comparison, Import-Csv is straightforward.

bump

bump