Hi i have a variable file: variable.ps1:
$Appserver1Box = "app11" $Webserver1Box = "web11" $Webserver2Box = "web22" $Webserver3Box = ""
From a a Powershell Program: PowershellProg.ps1 I am trying to get the above variables into my textboxes with:
get-content c:\variable.ps1
$Appserver1Box.Text = $Appserver1Box $Webserver1Box.Text = $Webserver1Box $Webserver2Box.Text = $Webserver2Box $Webserver3Box.Text = $Webserver3Box
However, all my textboxes get filled with: System.Windows.Forms.TextBox, Text: and comboboxes get filled with: System.Windows.Forms.ComboBox, Items.Count: 0
ok so i changed it to :
.c:\variables.ps1 (instead of get-content c:\variables.ps1)
and can now get the variables by asking for $Appserver1Box: write-host "$Appserver1Box".
Thats fine. But when i try to insert them in my textboxes im presented with:
ERROR: Property 'Text' cannot be found on this object; make sure it exists and is settable. testWcode8.pff (1461): ERROR: At Line: 1461 char: 1 ERROR: + $Appserver1Box.Text = Appserver1Box ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ERROR: + CategoryInfo : InvalidOperation: (:) [], RuntimeException ERROR: + FullyQualifiedErrorId : PropertyAssignmentException ERROR:
any help will be appriciated!
br
Bjorn