I am working on a GUI in powershell. I need help writing a foreach loop that looks at the information in a DataGrid and creates 2 variables based on the input in the 2 columns of each row.
something like
for each row
v1 = column1
v2 = column2
do something
then repeat.
Actual code
Function RenameComputers{
foreach ($item in $DataGrid.Items){
$OName = $item.OldName
$NName = $item.NewName
write-host "$OName and $NName"
netdom renamecomputer $OName /newName:$NName /uD:$Username /passwordD:$Password /force /reboot
}
}