Intune Initial Scripts Backup

This commit is contained in:
2025-04-21 14:21:38 -04:00
commit 71764cd10f
241 changed files with 28218 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,218 @@
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: b24654a3-c952-4b96-8e01-c56d9800c4a7
# Source File: FirstForm4-tabs.psf
#------------------------------------------------------------------------
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
UwsAAB+LCAAAAAAABADFVl1vmzAUfZ+0/2DxzELIR9NIBKkhjVStXasl6/ZWGbhJvBo7sk0T9utn
B5Lla4VKaSokBPY5Pvf6XF/wvkPEX0BkA6ww0g+ScNazGjXX8j9/Qsi7F2RKGKZDQuEbTsAfEiHV
kIuk9UXhUNbmcuI5B6icG/6GSCGVzaFnjTKpIKn9JCzmC1kzK+R3Gx2bstFjEUyrVjeXjYKUqlRA
j0GqBKY2ekhDSqKvkI35M7Be2OngdtS+cLvNFtQvuxZiOpSeNdHruRaKZoTGQuOsgDMlOJV5ijrQ
B8HnIFRWEK5SxUcRpjAgCTAThIZe2Mhtes4aWka94zFY/lArlXICSoCpEfmjCd22TvSi1SolmV22
/FVqpdgxLJWJRSSH0OsXrV3gbjmOizWfzLPnrGbX0HI7A56EvM+X725pZIRCvnzV1iPuUMoXAz1m
+WORwsFuHDJM4FgpwqbXDIcU4srMG53/VigaYEZ2d2+khF7ZRomMuKAkPMUO+fdMh2e0PkB7vOAf
pz0TsJ95BZ9ueYSVlrZ8t3Wpz16nAucOL00VDfiCFTY36hVo+Znd1G4FRt4U3IZro0YV/BiHNyyG
peYcQ28f9hFQfZohXuGDGWZTU9yb4J6Oze81BCfvCNX7Qz9VirN37w7hSuaNveFfHTTr3Yp1kBta
yFW2s9PWbh5+Sl5zs0p15V2+ejA/JDwSmWI6UhmFPo6eA065+E+D2zF79+VKSki0MSDX2GIk8094
wD1ns+q+Sl5O59A4ecmWK5ofs/MICbxYdeW3a9Wbk/akM3HduF3HTVyu9SuhZ8kp4AJOL7R5zUve
c7Z/ov2/L8SajlMLAAA=#>
#endregion
<#
.NOTES
--------------------------------------------------------------------------------
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.124
Generated on: 7/21/2016 3:30 PM
Generated by: administrator
--------------------------------------------------------------------------------
.DESCRIPTION
GUI script generated by PowerShell Studio 2016
#>
#----------------------------------------------
#region Application Functions
#----------------------------------------------
#endregion Application Functions
#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Call-FirstForm4-tabs_psf {
#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$combobox1 = New-Object 'System.Windows.Forms.ComboBox'
$button1 = New-Object 'System.Windows.Forms.Button'
$button_ComboBoxSelection = New-Object 'System.Windows.Forms.Button'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
$TextBox_Display = New-Object 'System.Windows.Forms.TextBox'
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$combobox1_SelectedIndexChanged={
#TODO: Place custom script here
}
$form1_Load={
#TODO: Place custom script here
}
$button1_Click={
#TODO: Place custom script here
Ba
}
$button_ComboBoxSelection_Click={
$TextBox_Display.text = $Combobox1.SelectedItem
}
$TextBox_Display_TextChanged={
}
# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$combobox1.remove_SelectedIndexChanged($combobox1_SelectedIndexChanged)
$form1.remove_Load($form1_Load)
$form1.remove_Load($Form_StateCorrection_Load)
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
}
catch [Exception]
{ }
}
#endregion Generated Events
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
$form1.SuspendLayout()
#
# form1
#
$form1.Controls.Add($combobox1)
$form1.Controls.Add($button1)
$form1.Controls.Add($button_ComboBoxSelection)
$form1.Controls.Add($TextBox_Display)
$form1.AutoScaleDimensions = '6, 13'
$form1.AutoScaleMode = 'Font'
$form1.ClientSize = '950, 644'
$form1.Name = 'form1'
$form1.Text = 'Form'
$form1.add_Load($form1_Load)
#
# combobox1
#
$combobox1.AllowDrop = $True
$combobox1.FormattingEnabled = $True
#$combobox1.Items.AddRange("")
<#
[void]$combobox1.Items.Add('One')
[void]$combobox1.Items.Add('Two')
[void]$combobox1.Items.Add('Three')
#>
#
#
$TextBox_Display.Location = '278, 120'
$TextBox_Display.Name = 'VCenterUserPassword'
$TextBox_Display.Size = '132, 20'
$TextBox_Display.TabIndex = 8
$TextBox_Display.add_TextChanged($TextBox_Display_TextChanged)
#
$combobox1.Location = '148, 67'
#$combobox1.MaxDropDownItems = 20
$Combobox1.Text="- Select -"
$combobox1.Name = 'combobox1'
$combobox1.Size = '121, 21'
$combobox1.TabIndex = 1
$combobox1.add_SelectedIndexChanged($combobox1_SelectedIndexChanged)
#
# button1
#
$button1.Location = '309, 67'
$button1.Name = 'button1'
$button1.Size = '75, 23'
$button1.TabIndex = 0
$button1.Text = 'button1'
$button1.UseVisualStyleBackColor = $True
$form1.ResumeLayout()
$button1.add_Click($button1_Click)
#endregion Generated Form Code
#
# button_ComboBoxSelection
$button_ComboBoxSelection.Location = '309, 40'
$button_ComboBoxSelection.Name = 'button_ComboBoxSelection'
$button_ComboBoxSelection.Size = '75, 23'
$button_ComboBoxSelection.TabIndex = 1
$button_ComboBoxSelection.Text = 'Select Item'
$button_ComboBoxSelection.add_Click($button_ComboBoxSelection_Click)
#
#----------------------------------------------
#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($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $form1.ShowDialog()
} #End Function
Function Ba {
#$combobox1.Items.Add('a')
$combobox1.Items.Clear()
$P = Get-Process | select -ExpandProperty ProcessName
$P | % { $combobox1.Items.Add($_) }
}
#Call the form
Call-FirstForm4-tabs_psf | Out-Null

View File

@@ -0,0 +1,222 @@
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: b24654a3-c952-4b96-8e01-c56d9800c4a7
# Source File: FirstForm4-tabs.psf
#------------------------------------------------------------------------
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
UwsAAB+LCAAAAAAABADFVl1vmzAUfZ+0/2DxzELIR9NIBKkhjVStXasl6/ZWGbhJvBo7sk0T9utn
B5Lla4VKaSokBPY5Pvf6XF/wvkPEX0BkA6ww0g+ScNazGjXX8j9/Qsi7F2RKGKZDQuEbTsAfEiHV
kIuk9UXhUNbmcuI5B6icG/6GSCGVzaFnjTKpIKn9JCzmC1kzK+R3Gx2bstFjEUyrVjeXjYKUqlRA
j0GqBKY2ekhDSqKvkI35M7Be2OngdtS+cLvNFtQvuxZiOpSeNdHruRaKZoTGQuOsgDMlOJV5ijrQ
B8HnIFRWEK5SxUcRpjAgCTAThIZe2Mhtes4aWka94zFY/lArlXICSoCpEfmjCd22TvSi1SolmV22
/FVqpdgxLJWJRSSH0OsXrV3gbjmOizWfzLPnrGbX0HI7A56EvM+X725pZIRCvnzV1iPuUMoXAz1m
+WORwsFuHDJM4FgpwqbXDIcU4srMG53/VigaYEZ2d2+khF7ZRomMuKAkPMUO+fdMh2e0PkB7vOAf
pz0TsJ95BZ9ueYSVlrZ8t3Wpz16nAucOL00VDfiCFTY36hVo+Znd1G4FRt4U3IZro0YV/BiHNyyG
peYcQ28f9hFQfZohXuGDGWZTU9yb4J6Oze81BCfvCNX7Qz9VirN37w7hSuaNveFfHTTr3Yp1kBta
yFW2s9PWbh5+Sl5zs0p15V2+ejA/JDwSmWI6UhmFPo6eA065+E+D2zF79+VKSki0MSDX2GIk8094
wD1ns+q+Sl5O59A4ecmWK5ofs/MICbxYdeW3a9Wbk/akM3HduF3HTVyu9SuhZ8kp4AJOL7R5zUve
c7Z/ov2/L8SajlMLAAA=#>
#endregion
<#
.NOTES
--------------------------------------------------------------------------------
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.124
Generated on: 7/21/2016 3:30 PM
Generated by: administrator
--------------------------------------------------------------------------------
.DESCRIPTION
GUI script generated by PowerShell Studio 2016
#>
#----------------------------------------------
#region Application Functions
#----------------------------------------------
#endregion Application Functions
#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Call-FirstForm4-tabs_psf {
#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$combobox1 = New-Object 'System.Windows.Forms.ComboBox'
$button1 = New-Object 'System.Windows.Forms.Button'
$button_ComboBoxSelection = New-Object 'System.Windows.Forms.Button'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
$TextBox_Display = New-Object 'System.Windows.Forms.TextBox'
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$combobox1_SelectedIndexChanged={
#TODO: Place custom script here
}
$form1_Load={
#TODO: Place custom script here
}
$button1_Click={
#TODO: Place custom script here
Ba
}
$button_ComboBoxSelection_Click={
$TextBox_Display.text = $Combobox1.SelectedItem
}
$TextBox_Display_TextChanged={
}
# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$combobox1.remove_SelectedIndexChanged($combobox1_SelectedIndexChanged)
$form1.remove_Load($form1_Load)
$form1.remove_Load($Form_StateCorrection_Load)
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
}
catch [Exception]
{ }
}
#endregion Generated Events
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
$form1.SuspendLayout()
#
# form1
#
$form1.Controls.Add($combobox1)
$form1.Controls.Add($button1)
$form1.Controls.Add($button_ComboBoxSelection)
$form1.Controls.Add($TextBox_Display)
$form1.AutoScaleDimensions = '6, 13'
$form1.AutoScaleMode = 'Font'
$form1.ClientSize = '950, 644'
$form1.Name = 'form1'
$form1.Text = 'Form'
$form1.add_Load($form1_Load)
#
# combobox1
#
$combobox1.AllowDrop = $True
$combobox1.FormattingEnabled = $True
#$combobox1.Items.AddRange("")
<#
[void]$combobox1.Items.Add('One')
[void]$combobox1.Items.Add('Two')
[void]$combobox1.Items.Add('Three')
#>
#
#
$TextBox_Display.Location = '278, 120'
$TextBox_Display.Name = 'VCenterUserPassword'
$TextBox_Display.Size = '132, 20'
$TextBox_Display.TabIndex = 8
$TextBox_Display.add_TextChanged($TextBox_Display_TextChanged)
#
$combobox1.Location = '148, 67'
#$combobox1.MaxDropDownItems = 20
$Combobox1.Text="- Select -"
$combobox1.Name = 'combobox1'
$combobox1.Size = '121, 21'
$combobox1.TabIndex = 1
$combobox1.add_SelectedIndexChanged($combobox1_SelectedIndexChanged)
#
# button1
#
$button1.Location = '309, 67'
$button1.Name = 'button1'
$button1.Size = '75, 23'
$button1.TabIndex = 0
$button1.Text = 'button1'
$button1.UseVisualStyleBackColor = $True
$form1.ResumeLayout()
$button1.add_Click($button1_Click)
#endregion Generated Form Code
#
# button_ComboBoxSelection
$button_ComboBoxSelection.Location = '309, 40'
$button_ComboBoxSelection.Name = 'button_ComboBoxSelection'
$button_ComboBoxSelection.Size = '75, 23'
$button_ComboBoxSelection.TabIndex = 1
$button_ComboBoxSelection.Text = 'Select Item'
$button_ComboBoxSelection.add_Click($button_ComboBoxSelection_Click)
#
#----------------------------------------------
#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($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $form1.ShowDialog()
} #End Function
Function Ba {
#$combobox1.Items.Add('a')
$combobox1.Items.Clear()
$P = Get-Process w* | select -ExpandProperty ProcessName
$P | % { $combobox1.Items.Add($_) }
}
#Call the form
Call-FirstForm4-tabs_psf | Out-Null

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
$objForm = New-Object Windows.Forms.Form
$objForm.Text = "Select a Date"
$objForm.Size = New-Object Drawing.Size @(490,250)
$objForm.StartPosition = "CenterScreen"
$objForm.KeyPreview = $True
$objForm.Add_KeyDown({
if ($_.KeyCode -eq "Enter")
{
$script:dtmDate=$objCalendar.SelectionStart
$objForm.Close()
}
})
$objForm.Add_KeyDown({
if ($_.KeyCode -eq "Escape")
{
$objForm.Close()
}
})
$objCalendar = New-Object System.Windows.Forms.MonthCalendar
$objCalendar.Text = "Start"
$objCalendar.ShowTodayCircle = $False
$objCalendar.MaxSelectionCount = 1
$objForm.Controls.Add($objCalendar)
$objForm.Topmost = $True
$objForm.Add_Shown({$objForm.Activate()})
[void] $objForm.ShowDialog()
if ($dtmDate)
{
Write-Host "Date selected: $dtmDate"
}
$objForm.Dispose()

View File

@@ -0,0 +1,489 @@
#############################
# Developed by Tinniam V Ganesh
# Date 24 Apr 2012
# Powershell GUI generated by Primal Forms CE from Sapien Technologies (http://www.sapien.com/)
#########################################################################################################
function Get-SysInfo ($strComputer)
{
write-host reached here
$statusBar1.Text =Working
if ($radiobutton1.checked -eq $True)
{
$wmi = Get-WmiObject Win32_ComputerSystem -Namespace root\CIMV2" -ComputerName $strComputer|Export-csv -force “test.csv”
}
else
{
$wmi =Get-WmiObject Win32_ComputerSystem -Namespace “root\CIMV2" -ComputerName $strComputer|ConvertTo-Html|out-file -append test.html
}
$statusBar1.Text =Done.
}
#*=============================================================================
Function Get-BIOSInfo ($strComputer)
{
$statusBar1.Text =Working
if ($radiobutton1.checked -eq $True)
{
$wmi = Get-WmiObject Win32_BIOS -Namespace root\CIMV2" -computername $strComputer|Export-csv -force “test.csv”
}
else
{
$wmi = Get-WmiObject Win32_BIOS -Namespace “root\CIMV2" -computername $strComputer|ConvertTo-Html|out-file -append test.html
}
$statusBar1.Text =Done.
}
Function Get-OSInfo {
$statusBar1.Text =Working
if ($radiobutton1.checked -eq $True)
{
$wmi = Get-WmiObject Win32_OperatingSystem -Namespace root\CIMV2" -Computername $strComputer|Export-csv -force “test.csv”
}
else
{
$wmi = Get-WmiObject Win32_OperatingSystem -Namespace “root\CIMV2" -Computername $strComputer|out-file -append test.html
}
$statusBar1.Text =Done.
}
Function Get-CPUInfo {
$statusBar1.Text =Working
if ($radiobutton1.checked -eq $True)
{
$wmi = Get-WmiObject Win32_Processor -Namespace root\CIMV2" -Computername $strComputer|Export-csv -force “test.csv”
}
else
{
$wmi = Get-WmiObject Win32_Processor -Namespace “root\CIMV2" -Computername $strComputer|out-file -append test.html
}
$statusBar1.Text =Done.
}
Function Get-DiskInfo {
$statusBar1.Text =Working
if ($radiobutton1.checked -eq $True)
{
$wmi = Get-WmiObject Win32_DiskDrive -Namespace root\CIMV2" -ComputerName $strComputer|Export-csv -force “test.csv”
}
else
{
$wmi = Get-WmiObject Win32_DiskDrive -Namespace “root\CIMV2" -ComputerName $strComputer|out-file -append test.html
}
$statusBar1.Text =Done.
}
Function Get-NetworkInfo {
$statusBar1.Text =Working
if ($radiobutton1.checked -eq $True)
{
$wmi = Get-WmiObject Win32_NetworkAdapterConfiguration -Namespace root\CIMV2" -ComputerName $strComputer | where{$_.IPEnabled -eq “True”}|Export-csv -noclobber “test.csv”
}
else
{
$wmi = Get-WmiObject Win32_NetworkAdapterConfiguration -Namespace “root\CIMV2" -ComputerName $strComputer | where{$_.IPEnabled -eq True}|out-file -append test.html
}
$statusBar1.Text =Done.
}
#Generated Form Function
function GenerateForm {
########################################################################
# Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.10.0
# Generated On: 4/24/2012 2:46 PM
# Generated By: tvganesh
########################################################################
#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
$statusBar1 = New-Object System.Windows.Forms.StatusBar
$label2 = New-Object System.Windows.Forms.Label
$button3 = New-Object System.Windows.Forms.Button
$button2 = New-Object System.Windows.Forms.Button
$tabControl1 = New-Object System.Windows.Forms.TabControl
$tabControl = New-Object System.Windows.Forms.TabPage
$groupBox1 = New-Object System.Windows.Forms.GroupBox
$radioButton2 = New-Object System.Windows.Forms.RadioButton
$radioButton1 = New-Object System.Windows.Forms.RadioButton
$label1 = New-Object System.Windows.Forms.Label
$textBox1 = New-Object System.Windows.Forms.TextBox
$comboBox1 = New-Object System.Windows.Forms.ComboBox
$Database = New-Object System.Windows.Forms.TabPage
$tabPage1 = New-Object System.Windows.Forms.TabPage
$tabPage2 = New-Object System.Windows.Forms.TabPage
$button1 = New-Object System.Windows.Forms.Button
$fontDialog1 = New-Object System.Windows.Forms.FontDialog
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects
#———————————————-
#Generated Event Script Blocks
#———————————————-
#Provide Custom Code for events specified in PrimalForms.
$button3_OnClick=
{
$form1.Close()
}
$button2_OnClick=
{
$textBox1.text="
# Set to the first item
$comboBox1.SelectedIndex = 0;
}
$handler_button1_Click=
{
$x = $textbox1.text
$vals = $x.split(“,”)
forEach($strComputer in $vals)
{
switch($combobox1.selectedItem)
{
“SysInfo” {Get-SysInfo ($strComputer)}
“BiosInfo” {Get-BiosInfo($strComputer)}
“CPUInfo” {Get-cpuInfo($strComputer)}
“DiskInfo” {Get-diskInfo($strComputer)}
“OSInfo” {Get-OSInfo($strCOmputer)}
“NetworkInfo” {Get-NetworkInfo($strComputer)}
}
}
}
$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 = 444
$System_Drawing_Size.Width = 704
$form1.ClientSize = $System_Drawing_Size
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
$form1.Name = “form1"
$form1.Text = Primal Form
$statusBar1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 0
$System_Drawing_Point.Y = 422
$statusBar1.Location = $System_Drawing_Point
$statusBar1.Name = statusBar1"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 22
$System_Drawing_Size.Width = 704
$statusBar1.Size = $System_Drawing_Size
$statusBar1.TabIndex = 8
$statusBar1.Text = “Ready”
$form1.Controls.Add($statusBar1)
$label2.DataBindings.DefaultDataSourceUpdateMode = 0
$label2.Font = New-Object System.Drawing.Font(“Microsoft Sans Serif”,14.25,1,3,1)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 205
$System_Drawing_Point.Y = 22
$label2.Location = $System_Drawing_Point
$label2.Name = “label2"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 34
$System_Drawing_Size.Width = 341
$label2.Size = $System_Drawing_Size
$label2.TabIndex = 7
$label2.Text = Windows Resource Management
$form1.Controls.Add($label2)
$button3.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 439
$System_Drawing_Point.Y = 343
$button3.Location = $System_Drawing_Point
$button3.Name = button3"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$button3.Size = $System_Drawing_Size
$button3.TabIndex = 6
$button3.Text = “Exit”
$button3.UseVisualStyleBackColor = $True
$button3.add_Click($button3_OnClick)
$form1.Controls.Add($button3)
$button2.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 330
$System_Drawing_Point.Y = 343
$button2.Location = $System_Drawing_Point
$button2.Name = “button2"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$button2.Size = $System_Drawing_Size
$button2.TabIndex = 5
$button2.Text = Cancel
$button2.UseVisualStyleBackColor = $True
$button2.add_Click($button2_OnClick)
$form1.Controls.Add($button2)
$tabControl1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 136
$System_Drawing_Point.Y = 83
$tabControl1.Location = $System_Drawing_Point
$tabControl1.Name = tabControl1"
$tabControl1.SelectedIndex = 0
$tabControl1.ShowToolTips = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 231
$System_Drawing_Size.Width = 453
$tabControl1.Size = $System_Drawing_Size
$tabControl1.TabIndex = 4
$form1.Controls.Add($tabControl1)
$tabControl.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 4
$System_Drawing_Point.Y = 22
$tabControl.Location = $System_Drawing_Point
$tabControl.Name = “tabControl”
$System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding
$System_Windows_Forms_Padding.All = 3
$System_Windows_Forms_Padding.Bottom = 3
$System_Windows_Forms_Padding.Left = 3
$System_Windows_Forms_Padding.Right = 3
$System_Windows_Forms_Padding.Top = 3
$tabControl.Padding = $System_Windows_Forms_Padding
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 205
$System_Drawing_Size.Width = 445
$tabControl.Size = $System_Drawing_Size
$tabControl.TabIndex = 0
$tabControl.Text = “Basic Commands”
$tabControl.UseVisualStyleBackColor = $True
$tabControl1.Controls.Add($tabControl)
$groupBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 271
$System_Drawing_Point.Y = 123
$groupBox1.Location = $System_Drawing_Point
$groupBox1.Name = “groupBox1"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 49
$System_Drawing_Size.Width = 124
$groupBox1.Size = $System_Drawing_Size
$groupBox1.TabIndex = 3
$groupBox1.TabStop = $False
$groupBox1.Text = Save As
$tabControl.Controls.Add($groupBox1)
$radioButton2.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 48
$System_Drawing_Point.Y = 19
$radioButton2.Location = $System_Drawing_Point
$radioButton2.Name = radioButton2"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 24
$System_Drawing_Size.Width = 104
$radioButton2.Size = $System_Drawing_Size
$radioButton2.TabIndex = 1
$radioButton2.TabStop = $True
$radioButton2.Text = “HTML”
$radioButton2.UseVisualStyleBackColor = $True
$groupBox1.Controls.Add($radioButton2)
$radioButton1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 6
$System_Drawing_Point.Y = 19
$radioButton1.Location = $System_Drawing_Point
$radioButton1.Name = “radioButton1"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 24
$System_Drawing_Size.Width = 104
$radioButton1.Size = $System_Drawing_Size
$radioButton1.TabIndex = 0
$radioButton1.TabStop = $True
$radioButton1.Text = CSV
$radioButton1.UseVisualStyleBackColor = $True
$radioButton1.checked =$True
$groupBox1.Controls.Add($radioButton1)
$label1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 6
$System_Drawing_Point.Y = 26
$label1.Location = $System_Drawing_Point
$label1.Name = label1"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 20
$System_Drawing_Size.Width = 192
$label1.Size = $System_Drawing_Size
$label1.TabIndex = 2
$label1.Text = “Enter comma separated server list”
$tabControl.Controls.Add($label1)
$textBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 220
$System_Drawing_Point.Y = 26
$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 = 203
$textBox1.Size = $System_Drawing_Size
$textBox1.TabIndex = 1
$tabControl.Controls.Add($textBox1)
$comboBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$comboBox1.FormattingEnabled = $True
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 220
$System_Drawing_Point.Y = 79
$comboBox1.Location = $System_Drawing_Point
$comboBox1.Name = comboBox1"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 21
$System_Drawing_Size.Width = 200
$comboBox1.Size = $System_Drawing_Size
$comboBox1.TabIndex = 0
$commands = @(“SysInfo”,”BIOSInfo”,”OSInfo”,”CPUInfo”,”DiskInfo”,”NetworkInfo”)
ForEach ($command in $commands){
$comboBox1.items.add($command)
}
$tabControl.Controls.Add($comboBox1)
# Set to the first item
$comboBox1.SelectedIndex = 0;
$Database.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 4
$System_Drawing_Point.Y = 22
$Database.Location = $System_Drawing_Point
$Database.Name = “Database”
$System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding
$System_Windows_Forms_Padding.All = 3
$System_Windows_Forms_Padding.Bottom = 3
$System_Windows_Forms_Padding.Left = 3
$System_Windows_Forms_Padding.Right = 3
$System_Windows_Forms_Padding.Top = 3
$Database.Padding = $System_Windows_Forms_Padding
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 205
$System_Drawing_Size.Width = 445
$Database.Size = $System_Drawing_Size
$Database.TabIndex = 1
$Database.Text = “Database”
$Database.UseVisualStyleBackColor = $True
$tabControl1.Controls.Add($Database)
$tabPage1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 4
$System_Drawing_Point.Y = 22
$tabPage1.Location = $System_Drawing_Point
$tabPage1.Name = “tabPage1"
$System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding
$System_Windows_Forms_Padding.All = 3
$System_Windows_Forms_Padding.Bottom = 3
$System_Windows_Forms_Padding.Left = 3
$System_Windows_Forms_Padding.Right = 3
$System_Windows_Forms_Padding.Top = 3
$tabPage1.Padding = $System_Windows_Forms_Padding
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 205
$System_Drawing_Size.Width = 445
$tabPage1.Size = $System_Drawing_Size
$tabPage1.TabIndex = 2
$tabPage1.Text = Active Directory
$tabPage1.UseVisualStyleBackColor = $True
$tabControl1.Controls.Add($tabPage1)
$tabPage2.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 4
$System_Drawing_Point.Y = 22
$tabPage2.Location = $System_Drawing_Point
$tabPage2.Name = tabPage2"
$System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding
$System_Windows_Forms_Padding.All = 3
$System_Windows_Forms_Padding.Bottom = 3
$System_Windows_Forms_Padding.Left = 3
$System_Windows_Forms_Padding.Right = 3
$System_Windows_Forms_Padding.Top = 3
$tabPage2.Padding = $System_Windows_Forms_Padding
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 205
$System_Drawing_Size.Width = 445
$tabPage2.Size = $System_Drawing_Size
$tabPage2.TabIndex = 3
$tabPage2.Text = “Backup & Restore”
$tabPage2.UseVisualStyleBackColor = $True
$tabControl1.Controls.Add($tabPage2)
$button1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 226
$System_Drawing_Point.Y = 343
$button1.Location = $System_Drawing_Point
$button1.Name = “button1"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 75
$button1.Size = $System_Drawing_Size
$button1.TabIndex = 0
$button1.Text = Submit
$button1.UseVisualStyleBackColor = $True
$button1.add_Click($handler_button1_Click)
$form1.Controls.Add($button1)
$fontDialog1.ShowHelp = $True
#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

View File

@@ -0,0 +1,144 @@
# Show message box popup.
Add-Type -AssemblyName System.Windows.Forms
$result = [System.Windows.Forms.MessageBox]::Show("My message", "Window Title", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::None)
# Show input box popup.
Add-Type -AssemblyName Microsoft.VisualBasic
$inputText = [Microsoft.VisualBasic.Interaction]::InputBox("Enter some value:", "Window Title", "Default value")
# Show an Open File Dialog and return the file selected by the user.
function Read-OpenFileDialog([string]$InitialDirectory, [switch]$AllowMultiSelect)
{
Add-Type -AssemblyName System.Windows.Forms
$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$openFileDialog.initialDirectory = $InitialDirectory
$openFileDialog.filter = "All files (*.*)| *.*"
if ($AllowMultiSelect) { $openFileDialog.MultiSelect = $true }
$openFileDialog.ShowDialog() > $null
if ($allowMultiSelect) { return $openFileDialog.Filenames } else { return $openFileDialog.Filename }
}
# Show an Open Folder Dialog and return the directory selected by the user.
function Read-FolderBrowserDialog([string]$InitialDirectory)
{
Add-Type -AssemblyName System.Windows.Forms
$openFolderDialog = New-Object System.Windows.Forms.FolderBrowserDialog
$openFolderDialog.ShowNewFolderButton = $true
$openFolderDialog.RootFolder = $InitialDirectory
$openFolderDialog.ShowDialog()
return $openFolderDialog.SelectedPath
}
# Prompt for multi-line user input:
function Read-MultiLineInputDialog([string]$Message, [string]$WindowTitle, [string]$DefaultText)
{
<#
.SYNOPSIS
Prompts the user with a multi-line input box and returns the text they enter, or null if they cancelled the prompt.
.DESCRIPTION
Prompts the user with a multi-line input box and returns the text they enter, or null if they cancelled the prompt.
.PARAMETER Message
The message to display to the user explaining what text we are asking them to enter.
.PARAMETER WindowTitle
The text to display on the prompt window's title.
.PARAMETER DefaultText
The default text to show in the input box.
.EXAMPLE
$userText = Read-MultiLineInputDialog "Input some text please:" "Get User's Input"
Shows how to create a simple prompt to get mutli-line input from a user.
.EXAMPLE
# Setup the default multi-line address to fill the input box with.
$defaultAddress = @'
John Doe
123 St.
Some Town, SK, Canada
A1B 2C3
'@
$address = Read-MultiLineInputDialog "Please enter your full address, including name, street, city, and postal code:" "Get User's Address" $defaultAddress
if ($address -eq $null)
{
Write-Error "You pressed the Cancel button on the multi-line input box."
}
Prompts the user for their address and stores it in a variable, pre-filling the input box with a default multi-line address.
If the user pressed the Cancel button an error is written to the console.
.EXAMPLE
$inputText = Read-MultiLineInputDialog -Message "If you have a really long message you can break it apart`nover two lines with the powershell newline character:" -WindowTitle "Window Title" -DefaultText "Default text for the input box."
Shows how to break the second parameter (Message) up onto two lines using the powershell newline character (`n).
If you break the message up into more than two lines the extra lines will be hidden behind or show ontop of the TextBox.
.NOTES
Name: Show-MultiLineInputDialog
Author: Daniel Schroeder (originally based on the code shown at http://technet.microsoft.com/en-us/library/ff730941.aspx)
Version: 1.0
#>
Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms
# Create the Label.
$label = New-Object System.Windows.Forms.Label
$label.Location = New-Object System.Drawing.Size(10,10)
$label.Size = New-Object System.Drawing.Size(280,20)
$label.AutoSize = $true
$label.Text = $Message
# Create the TextBox used to capture the user's text.
$textBox = New-Object System.Windows.Forms.TextBox
$textBox.Location = New-Object System.Drawing.Size(10,40)
$textBox.Size = New-Object System.Drawing.Size(575,200)
$textBox.AcceptsReturn = $true
$textBox.AcceptsTab = $false
$textBox.Multiline = $true
$textBox.ScrollBars = 'Both'
$textBox.Text = $DefaultText
# Create the OK button.
$okButton = New-Object System.Windows.Forms.Button
$okButton.Location = New-Object System.Drawing.Size(510,250)
$okButton.Size = New-Object System.Drawing.Size(75,25)
$okButton.Text = "OK"
$okButton.Add_Click({ $form.Tag = $textBox.Text; $form.Close() })
# Create the Cancel button.
$cancelButton = New-Object System.Windows.Forms.Button
$cancelButton.Location = New-Object System.Drawing.Size(415,250)
$cancelButton.Size = New-Object System.Drawing.Size(75,25)
$cancelButton.Text = "Cancel"
$cancelButton.Add_Click({ $form.Tag = $null; $form.Close() })
# Create the form.
$form = New-Object System.Windows.Forms.Form
$form.Text = $WindowTitle
$form.Size = New-Object System.Drawing.Size(600,310)
$form.FormBorderStyle = 'FixedSingle'
$form.StartPosition = "CenterScreen"
$form.AutoSizeMode = 'GrowAndShrink'
$form.Topmost = $True
$form.AcceptButton = $okButton
$form.CancelButton = $cancelButton
$form.ShowInTaskbar = $true
# Add all of the controls to the form.
$form.Controls.Add($label)
$form.Controls.Add($textBox)
$form.Controls.Add($okButton)
$form.Controls.Add($cancelButton)
# Initialize and show the form.
$form.Add_Shown({$form.Activate()})
$form.ShowDialog() > $null # Trash the text of the button that was clicked.
# Return the text that the user entered.
return $form.Tag
}

View 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

View File

@@ -0,0 +1,50 @@
Add-Type -AssemblyName System.Windows.Forms
$Form = New-Object system.Windows.Forms.Form
$Form.Text = "Sample Form"
$Form.AutoScroll = $True
$Form.width = 500
$Form.height = 300
$Form.AutoSize = $True
#$Form.AutoSizeMode = "GrowAndShrink"
# or GrowOnly
$Form.MinimizeBox = $False
$Form.MaximizeBox = $False
$Form.WindowState = "Normal"
# Maximized, Minimized, Normal
$Form.SizeGripStyle = "Hide"
# Auto, Hide, Show
$Form.ShowInTaskbar = $False
#$Form.Opacity = 0.7
# 1.0 is fully opaque; 0.0 is invisible
$Form.BackColor = "Lime"
# color names are static properties of System.Drawing.Color
# you can also use ARGB values, such as "#FFFFEBCD"
$Form.StartPosition = "CenterScreen"
# CenterScreen, Manual, WindowsDefaultLocation, WindowsDefaultBounds, CenterParent
$Form.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($PSHome + "\powershell.exe")
#$Font = New-Object System.Drawing.Font("Times New Roman",24,[System.Drawing.FontStyle]::Italic)
# Font styles are: Regular, Bold, Italic, Underline, Strikeout
#$Form.Font = $Font
$Label = New-Object System.Windows.Forms.Label
$Label.Text = "This form is very simple."
$Label.AutoSize = $True
$Form.Controls.Add($Label)
$OKButton = New-Object System.Windows.Forms.Button
$OKButton.Location = New-Object System.Drawing.Size(75,120)
$OKButton.Size = New-Object System.Drawing.Size(75,23)
$OKButton.Text = "Get Service"
$OKButton.Add_Click({$Form.Close()})
$Form.Controls.Add($OKButton)
$Form.ShowDialog()

View File

@@ -0,0 +1,91 @@
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$Form = New-Object System.Windows.Forms.Form
$Form.Size = New-Object System.Drawing.Size(600,400)
############################################## Start functions
function pingInfo {
$wks=$InputBox.text;
$pingResult=Test-Connection -ComputerName $wks -Count 1 | out-string;
$outputBox.text=$pingResult
} #end pingInfo
############################################## end functions
Function NA-GetHardDriveInfo {
$Computer = $InputBox.Text
$HDInfo = Gwmi Win32_logicaldisk -ComputerName $Computer -Filter "Drivetype = '3'" | ft -AutoSize | Out-String
$outputBox.Text = $HDInfo
}
############################################## Start text fields
Function NA-GetProcess {
$Computer = $InputBox.Text
$Proc = Get-Process -ComputerName $Computer | % {
$Obj = New-Object -TypeName PSObject
$Obj | Add-Member -MemberType NoteProperty -Name Handles -Value $_.handles
$Obj | Add-Member -MemberType NoteProperty -Name NPM -Value $_.npm
$Obj | Add-Member -MemberType NoteProperty -Name PM -Value $_.pm
$Obj | Add-Member -MemberType NoteProperty -Name WS -Value $_.WS
$Obj | Add-Member -MemberType NoteProperty -Name VM -Value $_.vm
$Obj | Add-Member -MemberType NoteProperty -Name CPU -Value $_.cpu
$Obj | Add-Member -MemberType NoteProperty -Name ID -Value $_.ID
$Obj | Add-Member -MemberType NoteProperty -Name ProcessName -Value $_.ProcessName
$Obj
}
$outputBox.Text = $Proc
}
############################################## end functions
$InputBox = New-Object System.Windows.Forms.TextBox
$InputBox.Location = New-Object System.Drawing.Size(20,50)
$InputBox.Size = New-Object System.Drawing.Size(150,20)
$Form.Controls.Add($InputBox)
$outputBox = New-Object System.Windows.Forms.TextBox
$outputBox.Location = New-Object System.Drawing.Size(10,150)
$outputBox.Size = New-Object System.Drawing.Size(565,200)
$outputBox.MultiLine = $True
$outputBox.ScrollBars = "Vertical"
$Form.Controls.Add($outputBox)
############################################## end text fields
############################################## Start buttons
$Button = New-Object System.Windows.Forms.Button
$Button.Location = New-Object System.Drawing.Size(400,30)
$Button.Size = New-Object System.Drawing.Size(80,20)
$Button.Text = "Ping"
$Button.Add_Click({pingInfo})
$Form.Controls.Add($Button)
############################################## end buttons
$Button_HDrive = New-Object System.Windows.Forms.Button
$Button_HDrive.Location = New-Object System.Drawing.Size(400,50)
$Button_HDrive.Size = New-Object System.Drawing.Size(80,20)
$Button_HDrive.Text = "Hard Drive"
$Button_HDrive.Add_Click({NA-GetHardDriveInfo})
$Form.Controls.Add($Button_HDrive)
############################################## end button_HDrive
$Button_Proc = New-Object System.Windows.Forms.Button
$Button_Proc.Location = New-Object System.Drawing.Size(400,70)
$Button_Proc.Size = New-Object System.Drawing.Size(80,20)
$Button_Proc.Text = "Processes"
$Button_Proc.Add_Click({NA-GetProcess})
$Form.Controls.Add($Button_Proc)
$Form.Add_Shown({$Form.Activate()})
[void] $Form.ShowDialog()

View File

@@ -0,0 +1,45 @@
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$Form = New-Object System.Windows.Forms.Form
$Form.Size = New-Object System.Drawing.Size(600,400)
############################################## Start functions
function pingInfo {
$wks=$InputBox.text;
$pingResult=ping $wks | fl | out-string;
$outputBox.text=$pingResult
} #end pingInfo
############################################## end functions
############################################## Start text fields
$InputBox = New-Object System.Windows.Forms.TextBox
$InputBox.Location = New-Object System.Drawing.Size(20,50)
$InputBox.Size = New-Object System.Drawing.Size(150,20)
$Form.Controls.Add($InputBox)
$outputBox = New-Object System.Windows.Forms.TextBox
$outputBox.Location = New-Object System.Drawing.Size(10,150)
$outputBox.Size = New-Object System.Drawing.Size(565,200)
$outputBox.MultiLine = $True
$outputBox.ScrollBars = "Vertical"
$Form.Controls.Add($outputBox)
############################################## end text fields
############################################## Start buttons
$Button = New-Object System.Windows.Forms.Button
$Button.Location = New-Object System.Drawing.Size(400,30)
$Button.Size = New-Object System.Drawing.Size(110,80)
$Button.Text = "Ping"
$Button.Add_Click({pingInfo})
$Form.Controls.Add($Button)
############################################## end buttons
$Form.Add_Shown({$Form.Activate()})
[void] $Form.ShowDialog()

View File

@@ -0,0 +1,165 @@
#========================================================================
# Code Generated By: SAPIEN Technologies, Inc., PowerShell Studio 2012 v3.1.13
# Generated On: 12/18/2012 2:15 PM
# Generated By: James Vierra
# Organization: Designed Systems & Services
#========================================================================
#----------------------------------------------
#region Application Functions
#----------------------------------------------
function OnApplicationLoad {
#Note: This function is not called in Projects
#Note: This function runs before the form is created
#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
#Important: Form controls cannot be accessed in this function
#TODO: Add snapins and custom code to validate the application load
return $true #return true for success or false for failure
}
function OnApplicationExit {
#Note: This function is not called in Projects
#Note: This function runs after the form is closed
#TODO: Add custom code to clean up and unload snapins when the application exits
$script:ExitCode = 0 #Set the exit code for the Packager
}
#endregion Application Functions
#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Call-Demo-WebBrowserCtl_pff {
#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
[void][reflection.assembly]::Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
#endregion Import Assemblies
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$buttonGetElement = New-Object 'System.Windows.Forms.Button'
$webbrowser1 = New-Object 'System.Windows.Forms.WebBrowser'
$buttonOK = New-Object 'System.Windows.Forms.Button'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$FormEvent_Load={
#TODO: Initialize Form Controls here
$webbrowser1.navigate("http://www.google.com")
}
$buttonGetElement_Click={
#TODO: Place custom script here
$el=$webbrowser1.Document.GetElementById('gstyle')
[System.Windows.Forms.MessageBox]::Show($el.InnerHtml)
}
# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$buttonGetElement.remove_Click($buttonGetElement_Click)
$form1.remove_Load($FormEvent_Load)
$form1.remove_Load($Form_StateCorrection_Load)
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
}
catch [Exception]
{ }
}
#endregion Generated Events
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
#
# form1
#
$form1.Controls.Add($buttonGetElement)
$form1.Controls.Add($webbrowser1)
$form1.Controls.Add($buttonOK)
$form1.AcceptButton = $buttonOK
$form1.ClientSize = '520, 475'
$form1.FormBorderStyle = 'FixedDialog'
$form1.MaximizeBox = $False
$form1.MinimizeBox = $False
$form1.Name = "form1"
$form1.StartPosition = 'CenterScreen'
$form1.Text = "Form"
$form1.add_Load($FormEvent_Load)
#
# buttonGetElement
#
$buttonGetElement.Location = '50, 438'
$buttonGetElement.Name = "buttonGetElement"
$buttonGetElement.Size = '84, 24'
$buttonGetElement.TabIndex = 2
$buttonGetElement.Text = "Get Element"
$buttonGetElement.UseVisualStyleBackColor = $True
$buttonGetElement.add_Click($buttonGetElement_Click)
#
# webbrowser1
#
$webbrowser1.Location = '39, 127'
$webbrowser1.MinimumSize = '20, 20'
$webbrowser1.Name = "webbrowser1"
$webbrowser1.Size = '569, 385'
$webbrowser1.TabIndex = 1
#
# buttonOK
#
$buttonOK.Anchor = 'Bottom, Right'
$buttonOK.DialogResult = 'OK'
$buttonOK.Location = '433, 440'
$buttonOK.Name = "buttonOK"
$buttonOK.Size = '75, 23'
$buttonOK.TabIndex = 0
$buttonOK.Text = "OK"
$buttonOK.UseVisualStyleBackColor = $True
#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($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $form1.ShowDialog()
} #End Function
#Call OnApplicationLoad to initialize
if((OnApplicationLoad) -eq $true)
{
#Call the form
Call-Demo-WebBrowserCtl_pff | Out-Null
#Perform cleanup
OnApplicationExit
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,432 @@
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
function mouseDown {
$Global:mCurFirstX = ([System.Windows.Forms.Cursor]::Position.X )
$Global:mCurFirstY = ([System.Windows.Forms.Cursor]::Position.Y )
}
function mouseMove ($mControlName) {
$mCurMoveX = ([System.Windows.Forms.Cursor]::Position.X )
$mCurMoveY = ([System.Windows.Forms.Cursor]::Position.Y )
if ($Global:mCurFirstX -ne 0 -and $Global:mCurFirstY -ne 0){
$mDifX = $Global:mCurFirstX - $mCurMoveX
$mDifY = $Global:mCurFirstY - $mCurMoveY
$this.Left = $this.Left - $mDifX
$this.Top = $this.Top - $mDifY
$Global:mCurFirstX = $mCurMoveX
$Global:mCurFirstY = $mCurMoveY
}
}
function mouseUP ($mControlObj) {
$mCurUpX = ([System.Windows.Forms.Cursor]::Position.X )
$mCurUpY = ([System.Windows.Forms.Cursor]::Position.Y )
$Global:mCurFirstX = 0
$Global:mCurFirstY = 0
Foreach ($mElement In $Global:mFormObj.Elements){
if ($mElement.Name -eq $this.name){
foreach( $mProp in $mElement.Properties){
Switch($mProp.Name){
'Top'{ $mProp.Value = $this.Top}
'Left'{$mProp.Value = $this.Left}
}
}
}
}
renewGrids
}
Function renewGrids {
$mList = New-Object System.Collections.ArrayList
[array]$mElementsArr = $mFormObj.Elements | select Name,Type
$mList.AddRange($mElementsArr)
$mElemetnsGrid.DataSource = $mList
$mElemetnsGrid.Columns[1].ReadOnly = $true
$mList2 = New-Object System.Collections.ArrayList
[array]$mPropertyArr = $mFormObj.Elements[$mElemetnsGrid.CurrentRow.Index].Properties
$mList2.AddRange($mPropertyArr)
$mPropertiesGrid.DataSource = $mList2
$mPropertiesGrid.Columns[0].ReadOnly=$true
}
Function DeleteElement {
$Global:mFormObj.Elements = $mFormObj.Elements | ?{$_.Name -notlike $mFormObj.Elements[$mElemetnsGrid.CurrentRow.Index].Name}
renewGrids
}
Function AddProperty ($mName,$mValue){
$mPropertyObj = New-Object PSCustomObject
$mPropertyObj | Add-Member -Name 'Name' -MemberType NoteProperty -Value $mName
$mPropertyObj | Add-Member -Name 'Value' -MemberType NoteProperty -Value $mValue
return $mPropertyObj
}
Function ElementsChanged{
$mList2 = New-Object System.Collections.ArrayList
[array]$mPropertyArr = $mFormObj.Elements[$mElemetnsGrid.CurrentRow.Index].Properties
$mList2.AddRange($mPropertyArr)
$mPropertiesGrid.DataSource = $mList2
}
function ElementsEndEdit {
$Global:mFormObj.Elements[$mElemetnsGrid.CurrentRow.Index].Name = $mElemetnsGrid.CurrentCell.FormattedValue
repaintForm
}
Function AddElement {
$mPropertiesArr =@()
$mSameType = ($mFormObj.Elements | ?{$_.Type -like $mControlType.SelectedItem})
if($mSameType.count -ne $NUll -and $mSameType -ne $null) {
$mControlName=''+$mControlType.SelectedItem+($mSameType.count+1)
}elseif($mSameType.Count -eq $null -and $mSameType -ne $null){
$mControlName=''+$mControlType.SelectedItem+'2'
}else{
$mControlName=''+$mControlType.SelectedItem+'1'
}
$mPropertiesArr+= AddProperty 'Text' $mControlName
$mPropertiesArr+= AddProperty 'SizeX' 100
$mPropertiesArr+= AddProperty 'SizeY' 23
$mPropertiesArr+= AddProperty 'Top' 5
$mPropertiesArr+= AddProperty 'Left' 5
$mPropertiesArr+= AddProperty 'Anchor' 'Left,Top'
$mElementsObj = New-Object PSCustomObject
$mElementsObj |Add-Member -Name 'Name' -MemberType NoteProperty -Value $mControlName
$mElementsObj |Add-Member -Name 'Type' -MemberType NoteProperty -Value ($mControlType.SelectedItem)
$mElementsObj |Add-Member -Name 'Properties' -MemberType NoteProperty -Value $mPropertiesArr
$Global:mFormObj.Elements += $mElementsObj
renewGrids
repaintForm
}
function AddControl ($mControl) {
$mReturnControl = $null
switch ($mControl.Type){
"TextBox" {$mReturnControl = New-Object System.Windows.Forms.TextBox}
"ListBox" {$mReturnControl = New-Object System.Windows.Forms.ListBox}
"ComboBoX" {$mReturnControl = New-Object System.Windows.Forms.ComboBox}
"Label" {$mReturnControl = New-Object System.Windows.Forms.Label}
"DataGrid" {$mReturnControl = New-Object System.Windows.Forms.DataGridView}
"Button" {$mReturnControl = New-Object System.Windows.Forms.Button}
'CheckBox' {$mReturnControl = New-Object System.Windows.Forms.CheckBox}
'DateTimePicker' {$mReturnControl = New-Object System.Windows.Forms.DateTimePicker}
'ListView' {$mReturnControl = New-Object System.Windows.Forms.ListView}
'PictureBox' {$mReturnControl = New-Object System.Windows.Forms.PictureBox}
'RichTextBox' {$mReturnControl = New-Object System.Windows.Forms.RichTextBox}
'TreeView' {$mReturnControl = New-Object System.Windows.Forms.TreeView}
'WebBrowser' {$mReturnControl = New-Object System.Windows.Forms.WebBrowser}
"default" {write-host 'something goes wrong sorry :('}
}
$mReturnControl.Name = $mControl.Name
$mSizeX=$null
$mSizeY=$null
foreach ($mProperty in $mControl.Properties){
switch ($mProperty.Name){
'Text' {$mReturnControl.Text=$mProperty.Value}
'SizeX' {$mSizeX=$mProperty.Value}
'SizeY' {$mSizeY=$mProperty.Value}
'Top' {$mReturnControl.Top=$mProperty.Value}
'Left' {$mReturnControl.Left=$mProperty.Value}
'Anchor'{$mReturnControl.Anchor=$mProperty.Value}
}
}
$mReturnControl.Size = New-Object System.Drawing.Size($mSizeX,$mSizeY)
$mReturnControl.Add_MouseDown({MouseDown})
$mReturnControl.Add_MouseMove({MouseMove ($mControl.Name)})
$mReturnControl.Add_MouseUP({MouseUP})
Return $mReturnControl
}
function PropertiesEndEdit{
foreach ($mProperty in $Global:mFormObj.Elements[$mElemetnsGrid.CurrentRow.Index].Properties){
if ($mProperty.Name -eq $mPropertiesGrid.currentrow.Cells[0].FormattedValue){
$mProperty.Value = $mPropertiesGrid.currentrow.Cells[1].FormattedValue
}
}
repaintForm
}
Function repaintForm {
$mFormGroupBox.Size = New-Object System.Drawing.Size(($mFormObj.SizeX),($mFormObj.SizeY))
$mFormGroupBox.controls.clear()
Foreach ($mElement in $mFormObj.Elements){
$mFormGroupBox.controls.add((AddControl $mElement))
}
}
Function EditFormSize ($x,$y){
$Global:mFormObj.SizeX = $X
$Global:mFormObj.SizeY = $Y
repaintForm
}
function ExportForm {
$mFormObj
$mExportString = "
"
$mExportString+= '
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$MyForm = New-Object System.Windows.Forms.Form
$MyForm.Text="MyForm"
$MyForm.Size = New-Object System.Drawing.Size('+$mFormObj.SizeX+','+$mFormObj.SizeY+')
'
foreach ($mElement in $mFormObj.Elements){
$mExportString+='
$m'+$mElement.Name+' = New-Object System.Windows.Forms.'+$mElement.Type+''
$mPrSizeX=''
$mPrSizeY=''
foreach ($mProperty in $mElement.Properties){
If ($mProperty.Name -eq 'SizeX'){
$mPrSizeX = $mProperty.Value
}
elseIf ($mProperty.Name -eq 'SizeY'){
$mPrSizeY = $mProperty.Value
}
else{
$mExportString+='
$m'+$mElement.Name+'.'+$mProperty.Name +'="'+$mProperty.Value+'"'
}
}
$mExportString+='
$m'+$mElement.Name+'.Size = New-Object System.Drawing.Size('+$mPrSizeX+','+$mPrSizeY+')
$MyForm.Controls.Add($m'+$mElement.Name+')
'
}
$mExportString+= '$MyForm.ShowDialog()'
$mFileName=''
$mFileName = get-filename 'C:\'
if ($mFileName -notlike ''){
$mExportString > $mFileName
}
}
Function Get-FileName($initialDirectory) {
$SaveFileDialog = New-Object System.Windows.Forms.SaveFileDialog
$SaveFileDialog.initialDirectory = $initialDirectory
$SaveFileDialog.filter = Powershell Script (*.ps1)|*.ps1|All files (*.*)|*.*
$SaveFileDialog.ShowDialog() | Out-Null
$SaveFileDialog.filename
}
$mForm = New-Object System.Windows.Forms.Form
$mForm.AutoSize = $true
$mForm.Text='FormsMaker'
$mControlType = New-Object System.Windows.Forms.ComboBoX
$mControlType.Anchor = 'Left,Top'
$mControlType.Size = New-Object System.Drawing.Size(100,23)
$mControlType.Left = 5
$mControlType.Top = 5
$mControlType.Items.Add("TextBox")
$mControlType.Items.Add("ListBox")
$mControlType.Items.Add("ComboBoX")
$mControlType.Items.Add("Label")
$mControlType.Items.Add("DataGrid")
$mControlType.Items.Add("Button")
$mControlType.Items.Add("CheckBox")
$mControlType.Items.Add("DateTimePicker")
$mControlType.Items.Add("ListView")
$mControlType.Items.Add("PictureBox")
$mControlType.Items.Add("RichTextBox")
$mControlType.Items.Add("TreeView")
$mControlType.Items.Add("WebBrowser")
$mForm.Controls.Add($mControlType)
$mAddButton = New-Object System.Windows.Forms.Button
$mAddButton.Anchor = 'Left,Top'
$mAddButton.Text = 'Add'
$mAddButton.Left = 110
$mAddButton.Top = 5
$mAddButton.Size = New-Object System.Drawing.Size(50,23)
$mAddButton.Add_Click({AddElement})
$mForm.Controls.Add($mAddButton)
$mFormLabel = New-Object System.Windows.Forms.Label
$mFormLabel.Text = 'Form Size:'
$mFormLabel.Top = 5
$mFormLabel.Left = 165
$mFormLabel.Anchor = 'Left,Top'
$mFormLabel.Size = New-Object System.Drawing.Size(80,23)
$mFormLabel.TextAlign='MiddleRight'
$mForm.Controls.Add($mFormLabel)
$mFormXTextBox = New-Object System.Windows.Forms.TextBox
$mFormXTextBox.left = 250
$mFormXTextBox.top = 5
$mFormXTextBox.Size = New-Object System.Drawing.Size(30,23)
$mFormXTextBox.Anchor = 'Left,Top'
$mFormXTextBox.Text=300
$mForm.Controls.Add($mFormXTextBox)
$mFormXLabel = New-Object System.Windows.Forms.Label
$mFormXLabel.Text = 'X'
$mFormXLabel.Top = 5
$mFormXLabel.Left = 280
$mFormXLabel.Anchor = 'Left,Top'
$mFormXLabel.Size = New-Object System.Drawing.Size(20,23)
$mFormXLabel.TextAlign='MiddleCenter'
$mFormXTextBox.Add_TextChanged({EditFormSize $mFormXTextBox.Text $mFormYTextBox.Text })
$mForm.Controls.Add($mFormXLabel)
$mFormYTextBox = New-Object System.Windows.Forms.TextBox
$mFormYTextBox.left = 300
$mFormYTextBox.top = 5
$mFormYTextBox.Size = New-Object System.Drawing.Size(30,23)
$mFormYTextBox.Anchor = 'Left,Top'
$mFormYTextBox.Text= 300
$mFormYTextBox.Add_TextChanged({EditFormSize $mFormXTextBox.Text $mFormYTextBox.Text})
$mForm.Controls.Add($mFormYTextBox)
$mFormGroupBox = New-Object System.Windows.Forms.GroupBox
$mFormGroupBox.left = 350
$mFormGroupBox.top = 5
$mFormGroupBox.Anchor = 'Left,Top'
$mFormGroupBox.Size = New-Object System.Drawing.Size($mFormXTextBox.Text,$mFormYTextBox.Text)
$mFormGroupBox.Text = 'New Form'
$mForm.Controls.Add($mFormGroupBox)
$mElemetnsGrid = New-Object System.Windows.Forms.DataGridView
$mElemetnsGrid.size = New-Object System.Drawing.Size(155,600)
$mElemetnsGrid.left=5
$mElemetnsGrid.top=33
$mElemetnsGrid.Anchor='Top,Left'
$mElemetnsGrid.RowHeadersVisible =$false
$mElemetnsGrid.Add_CellContentClick({ElementsChanged})
$mElemetnsGrid.Add_CellEndEdit({ElementsEndEdit})
$mForm.Controls.Add($mElemetnsGrid)
$mPropertiesGrid = New-Object System.Windows.Forms.DataGridView
$mPropertiesGrid.size = New-Object System.Drawing.Size(155,600)
$mPropertiesGrid.left=180
$mPropertiesGrid.top=33
$mPropertiesGrid.Anchor='Top,Left'
$mPropertiesGrid.ColumnHeadersVisible=$true
$mPropertiesGrid.RowHeadersVisible =$false
$mPropertiesGrid.Add_CellEndEdit({PropertiesEndEdit})
$mForm.Controls.Add($mPropertiesGrid)
$mDeleteButton = New-Object System.Windows.Forms.Button
$mDeleteButton.size = New-Object System.Drawing.Size(155,23)
$mDeleteButton.Text = 'Delete'
$mDeleteButton.Left = 5
$mDeleteButton.Top = 638
$mDeleteButton.Anchor = 'Top,Left'
$mDeleteButton.Add_Click({DeleteElement})
$mForm.Controls.Add($mDeleteButton)
$mExportButton = New-Object System.Windows.Forms.Button
$mExportButton.size = New-Object System.Drawing.Size(155,23)
$mExportButton.text = 'Export'
$mExportButton.Left = 180
$mExportButton.top = 638
$mExportButton.Anchor='Top,Left'
$mExportButton.Add_Click({ExportForm})
$mForm.Controls.Add($mExportButton)
$Global:mFormObj = new-object PSCustomObject
$Global:mFormObj | Add-Member -Name 'SizeX' -MemberType NoteProperty -Value 300
$Global:mFormObj | Add-Member -Name 'SizeY' -MemberType NoteProperty -Value 300
$Global:mFormObj | Add-Member -Name 'Elements' -MemberType NoteProperty -Value @()
$Global:mCurFirstX =0
$Global:mCurFirstY =0
$mForm.ShowDialog()

View File

@@ -0,0 +1,208 @@
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: 676f8db7-35c7-452d-b353-a4b40f26243a
# Source File: Form-Template.psf
#------------------------------------------------------------------------
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
RAUAAB+LCAAAAAAABAC9VNtKwzAYvhd8h5Dr2oPd3AZtYXTuxtNwQ72TrP07o2lSknSzPr3p2g1x
QkHGKJSk+Q7/KQ0eIRFrkNWEaILMQlHBQ3xpezg6P0MoeJB0RTlhU8rgnuQQTYXMLxaQF4xosAuV
Bc4BpmEu3yHRSFcFhHheKQ25/Ux5KjbKrkWat4X+OrLQUxtKz3brx0JxyXQpIeRQakmYhWblktHk
BqqF+AAeLgcD0k/6V97I74E7HGHETSghzoyeh1HyRlkqDQ7HgmspmGoSNIHOpChA6qoljEst5glh
MKE58DoIA72ykOcHzg7aRb0TKWBTKq47OTGjwPWcfhnCwDU+/nDYSaqrjKNtap3YBXxqvG3bIfR6
bbxb3K0gaav5Wq8DZ3vaNNNputlsxkpBbooPaqfTfqmiXCVCMro8QgMDZ6/626UZmVN4HH0sux3r
m3gaI0k2lK/+4+X6WT8bZJ6X9l3ik26vl5ydJKdYSDi+0X7bjHzg/PxrRt9OzyrdRAUAAA==#>
#endregion
<#
.NOTES
--------------------------------------------------------------------------------
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.141
Generated on: 8/29/2017 11:53 AM
Generated by: Haidey2
--------------------------------------------------------------------------------
.DESCRIPTION
GUI script generated by PowerShell Studio 2017
#>
#----------------------------------------------
#region Application Functions
#----------------------------------------------
#endregion Application Functions
#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Show-Form-Template_psf {
#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
$PanelEventLogs_Events = New-Object 'System.Windows.Forms.Panel'
$PanelEventLogs_Filter = New-Object 'System.Windows.Forms.Panel'
$Text_ELogs_ServerName = New-Object 'System.Windows.Forms.TextBox'
$Text_ELogs_EventID = New-Object 'System.Windows.Forms.TextBox'
$Text_Elogs_DaysBack = New-Object 'System.Windows.Forms.TextBox'
$Button_ELogs_Connect = New-Object 'System.Windows.Forms.Button'
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$form1_Load={
#TODO: Initialize Form Controls here
}
# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$form1.remove_Load($form1_Load)
$form1.remove_Load($Form_StateCorrection_Load)
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
$PanelEventLogs_Events.remove_Paint($PanelEventLogs_Events_Paint)
$PanelEventLogs_Filter.remove_Paint($PanelEventLogs_Filter_Paint)
$Text_Elogs_DaysBack.remove_TextChanged($Text_Elogs_DaysBack_TextChanged)
$Text_ELogs_ServerName.remove_TextChanged($Text_ELogs_ServerName_TextChanged)
$Text_ELogs_EventID.remove_TextChanged($Text_ELogs_EventID_TextChanged)
}
catch { Out-Null <# Prevent PSScriptAnalyzer warning #> }
}
$PanelEventLogs_Events_Paint=[System.Windows.Forms.PaintEventHandler]{ <#Event Argument: $_ = [System.Windows.Forms.PaintEventArgs]#> }
$PanelEventLogs_Filter_Paint=[System.Windows.Forms.PaintEventHandler]{ }
$Text_ELogs_ServerName_TextChanged={}
$Text_Elogs_DaysBack_TextChanged={}
#endregion Generated Events
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
#
# form1
#
$form1.Controls.Add($PanelEventLogs_Events)
$form1.Controls.Add($PanelEventLogs_Filter)
$form1.AutoScaleDimensions = '6, 13'
$form1.AutoScaleMode = 'Font'
$form1.ClientSize = '1200, 780'
$form1.Name = 'form1'
$form1.Text = 'Form'
$form1.add_Load($form1_Load)
#endregion Generated Form Code
#----------------------------------------------
$PanelEventLogs_Events.Controls.Add($Text_ELogs_ServerName)
$PanelEventLogs_Events.Controls.Add($Button_ELogs_Connect)
$PanelEventLogs_Events.Controls.Add($Button_ELogs_View)
$PanelEventLogs_Events.Controls.Add($Combobox_EventLogs_LogsList)
$PanelEventLogs_Events.Controls.Add($VCenterUserPassword)
$PanelEventLogs_Events.Controls.Add($CheckBoxUseWindowsLogin)
$PanelEventLogs_Events.Controls.Add($labelVCenterUserName)
$PanelEventLogs_Events.Controls.Add($labelVCenterPassword)
$PanelEventLogs_Events.BackColor = '153,153,153'
$PanelEventLogs_Events.Location = '6, 6'
$PanelEventLogs_Events.Name = 'panelEventLogs_Events'
$PanelEventLogs_Events.Size = '598, 56'
$PanelEventLogs_Events.TabIndex = 0
$PanelEventLogs_Events.add_Paint($PanelEventLogs_Events_Paint)
$PanelEventLogs_Filter.Controls.Add($Combobox_ELogsFilter_Level)
$PanelEventLogs_Filter.Controls.Add($Text_ELogs_EventID)
$PanelEventLogs_Filter.Controls.Add($Text_Elogs_DaysBack)
$PanelEventLogs_Filter.Controls.Add($label_ELogs_Level)
$PanelEventLogs_Filter.Controls.Add($label_ELogs_EventID)
$PanelEventLogs_Filter.Controls.Add($label_ELogs_DaysBack)
$PanelEventLogs_Filter.BackColor = '255,255,212'
$PanelEventLogs_Filter.Location = '6, 62'
$PanelEventLogs_Filter.Name = 'PanelEventLogs_Filter'
$PanelEventLogs_Filter.Size = '598, 56'
$PanelEventLogs_Filter.BorderStyle = 'FixedSingle'
$PanelEventLogs_Filter.TabIndex = 0
$PanelEventLogs_Filter.add_Paint($PanelEventLogs_Filter_Paint)
#
# $Text_ELogs_ServerName
#
$Text_ELogs_ServerName.Location = '8, 26'
$Text_ELogs_ServerName.Name = '$Text_ELogs_ServerName'
$Text_ELogs_ServerName.Size = '100, 20'
$Text_ELogs_ServerName.text = "l2012"
$Text_ELogs_ServerName.TabIndex = 6
$Text_ELogs_ServerName.add_TextChanged($Text_ELogs_ServerName_TextChanged)
#
#
# Text_ELogs_EventID
#
$Text_ELogs_EventID.Location = '115, 26'
$Text_ELogs_EventID.Name = 'Text_ELogs_EventID'
$Text_ELogs_EventID.Size = '40, 20'
$Text_ELogs_EventID.TabIndex = 7
$Text_ELogs_EventID.add_TextChanged($Text_ELogs_EventID_TextChanged)
#
# Text_Elogs_DaysBack
#
$Text_Elogs_DaysBack.Location = '175, 26'
$Text_Elogs_DaysBack.Name = 'Text_Elogs_DaysBack'
$Text_Elogs_DaysBack.Size = '40, 20'
$Text_Elogs_DaysBack.TabIndex = 7
$Text_Elogs_DaysBack.add_TextChanged($Text_Elogs_DaysBack_TextChanged)
#
#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($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $form1.ShowDialog()
} #End Function
#Call the form
Show-Form-Template_psf | Out-Null