Intune Initial Scripts Backup
This commit is contained in:
114
dump/SCCM-Tool/Forms/Form-Examples/Form-Example-3.ps1
Normal file
114
dump/SCCM-Tool/Forms/Form-Examples/Form-Example-3.ps1
Normal file
@@ -0,0 +1,114 @@
|
||||
$ErrorActionPreference = "SilentlyContinue"
|
||||
Import-Module ActiveDirectory
|
||||
#Generated Form Function
|
||||
function GenerateForm {
|
||||
########################################################################
|
||||
# Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.10.0
|
||||
# Generated On: 8/20/2013 12:23 AM
|
||||
# Generated By: Subsun
|
||||
########################################################################
|
||||
|
||||
#region Import the Assemblies
|
||||
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
|
||||
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
|
||||
#endregion
|
||||
|
||||
#region Generated Form Objects
|
||||
$form1 = New-Object System.Windows.Forms.Form
|
||||
$richTextBox1 = New-Object System.Windows.Forms.RichTextBox
|
||||
$Find = New-Object System.Windows.Forms.Button
|
||||
$textBox1 = New-Object System.Windows.Forms.TextBox
|
||||
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
|
||||
#endregion Generated Form Objects
|
||||
|
||||
#----------------------------------------------
|
||||
#Generated Event Script Blocks
|
||||
#----------------------------------------------
|
||||
#Provide Custom Code for events specified in PrimalForms.
|
||||
$handler_Find_Click=
|
||||
{
|
||||
#TODO: Place custom script here
|
||||
$User = Get-Aduser $textBox1.Text -Properties Name,homeDirectory,SamAccountName,CanonicalName | Select Name,homeDirectory,SamAccountName,CanonicalName
|
||||
If ($User) {
|
||||
$richTextBox1.Text = $User | FL Name,homeDirectory,SamAccountName,CanonicalName | Out-String
|
||||
}Else {
|
||||
$richTextBox1.Text = "Error in finding $($textBox1.Text)"
|
||||
}
|
||||
}
|
||||
|
||||
$OnLoadForm_StateCorrection=
|
||||
{#Correct the initial state of the form to prevent the .Net maximized form issue
|
||||
$form1.WindowState = $InitialFormWindowState
|
||||
}
|
||||
|
||||
#----------------------------------------------
|
||||
#region Generated Form Code
|
||||
$System_Drawing_Size = New-Object System.Drawing.Size
|
||||
$System_Drawing_Size.Height = 212
|
||||
$System_Drawing_Size.Width = 477
|
||||
$form1.ClientSize = $System_Drawing_Size
|
||||
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
|
||||
$form1.Name = "form1"
|
||||
$form1.Text = "ADFind"
|
||||
|
||||
$richTextBox1.DataBindings.DefaultDataSourceUpdateMode = 0
|
||||
$System_Drawing_Point = New-Object System.Drawing.Point
|
||||
$System_Drawing_Point.X = 12
|
||||
$System_Drawing_Point.Y = 38
|
||||
$richTextBox1.Location = $System_Drawing_Point
|
||||
$richTextBox1.Name = "richTextBox1"
|
||||
$System_Drawing_Size = New-Object System.Drawing.Size
|
||||
$System_Drawing_Size.Height = 162
|
||||
$System_Drawing_Size.Width = 450
|
||||
$richTextBox1.Size = $System_Drawing_Size
|
||||
$richTextBox1.TabIndex = 2
|
||||
$richTextBox1.font = "Courier New"
|
||||
$richTextBox1.Text = ""
|
||||
|
||||
$form1.Controls.Add($richTextBox1)
|
||||
|
||||
|
||||
$Find.DataBindings.DefaultDataSourceUpdateMode = 0
|
||||
|
||||
$System_Drawing_Point = New-Object System.Drawing.Point
|
||||
$System_Drawing_Point.X = 353
|
||||
$System_Drawing_Point.Y = 8
|
||||
$Find.Location = $System_Drawing_Point
|
||||
$Find.Name = "Find"
|
||||
$System_Drawing_Size = New-Object System.Drawing.Size
|
||||
$System_Drawing_Size.Height = 23
|
||||
$System_Drawing_Size.Width = 109
|
||||
$Find.Size = $System_Drawing_Size
|
||||
$Find.TabIndex = 1
|
||||
$Find.Text = "Find"
|
||||
$Find.UseVisualStyleBackColor = $True
|
||||
$Find.add_Click($handler_Find_Click)
|
||||
|
||||
$form1.Controls.Add($Find)
|
||||
|
||||
$textBox1.DataBindings.DefaultDataSourceUpdateMode = 0
|
||||
$System_Drawing_Point = New-Object System.Drawing.Point
|
||||
$System_Drawing_Point.X = 12
|
||||
$System_Drawing_Point.Y = 12
|
||||
$textBox1.Location = $System_Drawing_Point
|
||||
$textBox1.Name = "textBox1"
|
||||
$System_Drawing_Size = New-Object System.Drawing.Size
|
||||
$System_Drawing_Size.Height = 20
|
||||
$System_Drawing_Size.Width = 320
|
||||
$textBox1.Size = $System_Drawing_Size
|
||||
$textBox1.TabIndex = 0
|
||||
$form1.Controls.Add($textBox1)
|
||||
|
||||
#endregion Generated Form Code
|
||||
|
||||
#Save the initial state of the form
|
||||
$InitialFormWindowState = $form1.WindowState
|
||||
#Init the OnLoad event to correct the initial state of the form
|
||||
$form1.add_Load($OnLoadForm_StateCorrection)
|
||||
#Show the Form
|
||||
$form1.ShowDialog()| Out-Null
|
||||
|
||||
} #End Function
|
||||
|
||||
#Call the Function
|
||||
GenerateForm
|
||||
Reference in New Issue
Block a user