for-each loop
trying loop here this
$vmwareluns = get-content c:\luns.txt
$igroup = get-content c:\igroup
foreach ($i in $vmwareluns}
{add-nalunmap $vmwareluns $igroup}
keep getting error
idea?
need add loop?
---------------------
igroup contents
igroup1
igroup2
igroup3
--------------------
luns.txt contents
lun1
lun2
lun3
hi jon,
if can make sure lines matched in these 2 files, example, can find matched pattern igroup[$i] , lun[$i] @ line $i on both text files. in case, please refer script below:
$vmwareluns = get-content d:\1.txt $igroup = get-content d:\2.txt $count = $vmwareluns.count for($i=0;$i -lt $count;$i++){ $igroup[$i] $vmwareluns[$i] #add-nalunmap $vmwareluns[$i] $igroup[$i] }
if there else regarding issue, please feel free post back.
if have feedback on our support, please click here.
best regards,
anna wang
please remember mark replies answers if , unmark them if provide no help. if have feedback technet support, contact tnmff@microsoft.com
Windows Server > Windows PowerShell
Comments
Post a Comment