Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-Type -assembly System.Windows.Forms
- $main_form = New-Object System.Windows.Forms.Form
- $main_form.Text ='MDunns Amazing Distro Helper'
- $main_form.Width = 600
- $main_form.Height = 400
- $main_form.AutoSize = $true
- $Label1 = New-Object System.Windows.Forms.Label
- $Label1.Text = "Enter Distribution List SAMAccountName"
- $Label1.Location = New-Object System.Drawing.Point(0,10)
- $Label1.AutoSize = $true
- $main_form.Controls.Add($Label1)
- $Textbox1 = New-Object System.Windows.Forms.TextBox
- $Textbox1.Width = 300
- $TextBox1.Location = New-Object System.Drawing.Point(230,10)
- $main_form.Controls.Add($TextBox1)
- $Button1 = New-Object System.Windows.Forms.Button
- $Button1.Location = New-Object System.Drawing.Size(600,10)
- $Button1.Size = New-Object System.Drawing.Size(120,23)
- $Button1.Text = "Check Name"
- $main_form.Controls.Add($Button1)
- $Label2 = New-Object System.Windows.Forms.Label
- $Label2.Text = ""
- $Label2.Location = New-Object System.Drawing.Point(110,40)
- $Label2.AutoSize = $true
- $main_form.Controls.Add($Label2)
- $Button1.Add_Click(
- {
- $TB1 = Get-ADGroup -Identity $TextBox1.Text
- if ($TB1.GroupCategory -eq 'Distribution'){
- $Label2.Text = "The entered name is the name of a distribution group"
- }
- else {
- $Label2.Text = "The entered name is either incorrect or is not a distribution group"
- }
- }
- )
- $main_form.ShowDialog()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement