Hi,
I have a csv file, which has information like below (columns):
Name Datastore Folder
DSFPRDDB18_Replica dr-lun11-APP-vm VM
DSFPRDAPP182_Replica dr-lun16-APP-vm,dr-lun207-DB-vm VM
I wrote a .vbs script, but it is not working as expected. I am looking a for a powershell script which can will give me desired output.
I am looking for (ex: name has PRD, datastore has APP & name had DB, datastore has PRD, it should mail information. Same way, it should go through complete .CSV file and give me the output. If all the fields are mapped correclty, it should say: ALL GOOD.
.vbs script what I wrote:
strExcelPath = “C:\Opscripts\Kalyan\Vranger_Scripts\Lun_Check\Lun_Mapping_Wrong.csv”
set objexcel= createobject(“Excel.Application”)
objexcel.visible=False
Set objWorkBook=objExcel.WorkBooks.Open(strExcelPath)
intRow= objWorkBook.Worksheets(1).UsedRange.Rows.count
objWorkBook.Worksheets(1).Range(“D:D”).ClearContents
objWorkBook.Worksheets(1).cells(1,4) = “Results”
objexcel.DisplayAlerts =false
'To get the Column Values of the Fields
For i = 1 to intRow
if (instr(ucase(objWorkBook.Worksheets(1).Cells(i, 1)),“APP”) and instr(ucase(objWorkBook.Worksheets(1).Cells(i, 2)),“DB”)) Then
objWorkBook.Worksheets(1).Cells(i, 4) = “Error. Please check”
End if
if (instr(ucase(objWorkBook.Worksheets(1).Cells(i, 1)),"DB") and instr(ucase(objWorkBook.Worksheets(1).Cells(i, 2)),"APP")) Then
objWorkBook.Worksheets(1).Cells(i, 4) = "Error. Please check"
End If
Next
objWorkBook.Save
objWorkBook.Close
Set objexcel = nothing
-Kalyan