I'm trying to define variables to winform object: $Textbox_serverDNS1,$Textbox_serverDNS2,$Textbox_serverDNS3
I'm trying to use this syntax, but it's now working:
for ($i=1; $i -le 3; $i++){
Set-Variable -Name "TextBox_ServerDNS$($i)" -Value (New-Object -TypeName System.Windows.Forms.TextBox -Property @(Text = "10.10.10.$i")) -Scope Global
}
any idea how can I define it in this way?
thanks,

How about something like this?
I would double check to make sure you're loading the correct types/assemblies you need as well.