Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Gridview -passthru soll einen String in einem Textfeld in einer GUI einfügen.

$
0
0

Moin, ich versuche in meiner GUI durch eine out -GridView -passthru Eingabe ein Textfeld zu aktualisieren

Das ist mein Code

$buttonAccName.Location = '10, 175'
	$buttonAccName.Name = "labelAccname"
	$buttonAccName.Size = '100, 23'
	$buttonAccName.TabIndex = 11
	$buttonAccName.Text = "SendAsPrivilege"
	$buttonAccName.TextAlign = 'MiddleLeft'
	$buttonAccName.Add_Click({
$sauser = Get-ADUser -Filter * |Out-GridView -Passthru
$Porn = "hub"
})
if($Porn -eq "hub")
{
$sausanzahl = $sauser.count
$sausi = $sausanzahl -1
if ($sausanzahl = 1)
{
$Laccname = Get-ADUser $sauser |  Select-Object -ExpandProperty sAMAccountname
if ($saustext -notcontains "@")
{
$saustext = "@" + $Laccname
}
else
{
$saustext = $saustext + " @" + $Laccname
}
}
else
{
for ($n=0; $n -le $sausi ; $n++)
{
$Laccname = Get-ADUser $sauser[$n] |  Select-Object -ExpandProperty sAMAccountname
if ($n=0)
{
if($saustext -notcontains "@")
{
$saustext = "@"+$Laccname
}
else
{
$saustext = $saustext + " @" + $Laccname
}
}
else
{
$saustext = $saustext + " @" + $Laccname
}
}
}
}
# txtAccName
	$txtAccName.Anchor = 'Top, Left, Right'
	$txtAccName.Location = '118, 175'
	$txtAccName.Name = "txtAccName"
	$txtAccName.Size = '173, 20'
	$txtAccName.TabIndex = 12
	$txtAccName.Text = "$saustext



Viewing all articles
Browse latest Browse all 2314

Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>