I'm try to run this IIS cmdlet from a script:
Set-WebConfiguration system.webServer/httpRedirect "IIS:\sites\$i.SiteName" -Value @{enabled="true";destination=$i.RedirectURL;exactDestination="true";httpResponseStatus="Permanent"}
The part that is not working is the variable in "IIS:\sites\$i.SiteName"