Files
Intune/dump/Remote Software Center.ps1

1649 lines
48 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: f5f77db1-ba0b-4c5a-80b7-afa0e33b688d
# Source File: Remote Software Center.psproj
#------------------------------------------------------------------------
#region Project Recovery Data (DO NOT MODIFY)
<#RecoveryData:
/gEAAB+LCAAAAAAABACFkU9PwyAYh+9L9h0I966tc7YHxkGXmh38k3XxaqB9cSiFBuiWfXvRtssW
Nd54wu99fnmBbKAye7DHFfOMTicIkWdr3qHy3xDwBayTRtOrWULiEYa7QipYr6hYiCyreRpxlvDo
ulqwKE94FjHBEpjP+U2e1yQewsPo0LI9tkCD+BxHuVF1qEPxeZsbYEB020lVL3GCaemZ9V07a53r
u/5KonLHLITj1naA0QYEWNAVFJ2ufFhuidd6bz4guleGM/XauhTT/uyCPf3H/ouv3JlD9MCkLoxt
gk9gOlIQigthD/2ap2fp6cnKN6mZ+go8sgboBhrjAZVG+ENYCd2B9mCDsg1jJP6Rn05IfPHfn1/a
p1b+AQAA#>
#endregion
<#
.NOTES
--------------------------------------------------------------------------------
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.3.131
Generated on: 2017-01-18 13:57
Generated by: Timmy
--------------------------------------------------------------------------------
.DESCRIPTION
Script generated by PowerShell Studio 2016
#>
#region Source: Startup.pss
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
2gMAAB+LCAAAAAAABAC9k0tLAzEQgO+C/yH0vGR33a5rIbsglV4EFVfUazadLcE8yiRpyb+3rVJF
QaGHMJd5MPMxL/YIwm4A4w33nOwUJ61pJxe0nHTnZ4Swe5QrabhaSAV3XEPXe44+rOnaOZb/ih5y
rp0DPSgJ7mB/eWKnnbCo5JCR50/WlBZ7ycg8KB8QWgPBI1cZeQi7GuIW4pN9A9MOTcNrUV+Ws2oK
xdWM5ceqPyl9dB50CgZ9kWZpt44uLGqXhLjfVBoQ8q00q1NYRTXWYzOW5bIueMX/Z71qlaSnuUVI
MzyJILzF2ANupICTbuPvMR7Nj0dj+fdf7t4BtbYVHtoDAAA=#>
#endregion
#----------------------------------------------
#region Import 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')
[void][Reflection.Assembly]::Load('System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#Define a Param block to use custom parameters in the project
#Param ($CustomParameter)
function Main {
<#
.SYNOPSIS
The Main function starts the project application.
.PARAMETER Commandline
$Commandline contains the complete argument string passed to the script packager executable.
.NOTES
Use this function to initialize your script and to call GUI forms.
.NOTES
To get the console output in the Packager (Forms Engine) use:
$ConsoleOutput (Type: System.Collections.ArrayList)
#>
Param ([String]$Commandline)
#--------------------------------------------------------------------------
#TODO: Add initialization script here (Load modules and check requirements)
#--------------------------------------------------------------------------
if((Show-MainForm_psf) -eq 'OK')
{
}
$script:ExitCode = 0 #Set the exit code for the Packager
}
#endregion Source: Startup.pss
#region Source: Globals.ps1
#--------------------------------------------
# Declare Global Variables and Functions here
#--------------------------------------------
#Sample function that provides the location of the script
function Get-ScriptDirectory
{
<#
.SYNOPSIS
Get-ScriptDirectory returns the proper location of the script.
.OUTPUTS
System.String
.NOTES
Returns the correct path within a packaged executable.
#>
[OutputType([string])]
param ()
if ($null -ne $hostinvocation)
{
Split-Path $hostinvocation.MyCommand.path
}
else
{
Split-Path $script:MyInvocation.MyCommand.Path
}
}
#Sample variable that provides the location of the script
[string]$ScriptDirectory = Get-ScriptDirectory
function Write-Status
{
[cmdletbinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNull()]
[String]$Message
)
$statusbar1.Text = $Message
}
function Invoke-OSDInstall
{
Param
(
[String][Parameter(Mandatory = $True, Position = 1)]
$Computername,
[String][Parameter(Mandatory = $True, Position = 2)]
$OSDName
)
Begin
{
$CIMClass = (Get-CimClass -Namespace root\ccm\clientsdk -ComputerName $Computername -ClassName CCM_ProgramsManager)
$OSD = (Get-CimInstance -ClassName CCM_Program -Namespace "root\ccm\clientSDK" -ComputerName $Computername | Where-Object { $_.Name -like "$OSDName" })
$Args = @{
PackageID = $OSD.PackageID
ProgramID = $OSD.ProgramID
}
}
Process
{
Invoke-CimMethod -CimClass $CIMClass -ComputerName $Computername -MethodName "ExecuteProgram" Arguments $Args
}
End { }
}
Function Invoke-AppInstall
{
Param
(
[String][Parameter(Mandatory = $True, Position = 1)]
$Computername,
[String][Parameter(Mandatory = $True, Position = 2)]
$AppName,
[ValidateSet("Install", "Uninstall")]
[String][Parameter(Mandatory = $True, Position = 3)]
$Method
)
Begin
{
$Application = (Get-CimInstance -ClassName CCM_Application -Namespace "root\ccm\clientSDK" -ComputerName $Computername | Where-Object { $_.Name -like $AppName })
$Args = @{
EnforcePreference = [UINT32] 0
Id = "$($Application.id)"
IsMachineTarget = $Application.IsMachineTarget
IsRebootIfNeeded = $False
Priority = 'High'
Revision = "$($Application.Revision)"
}
}
Process
{
Invoke-CimMethod -Namespace "root\ccm\clientSDK" -ClassName CCM_Application -ComputerName $Computername -MethodName $Method -Arguments $Args
}
End { }
}
function Invoke-SupInstall
{
Param
(
[String][Parameter(Mandatory = $True, Position = 1)]
$Computername,
[String][Parameter(Mandatory = $True, Position = 2)]
$SupName
)
Begin
{
$AppEvalState0 = "0"
$AppEvalState1 = "1"
$ApplicationClass = [WmiClass]"root\ccm\clientSDK:CCM_SoftwareUpdatesManager"
}
Process
{
If ($SupName -Like "All" -or $SupName -like "all")
{
Foreach ($Computer in $Computername)
{
$Application = (Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_SoftwareUpdate -ComputerName $Computer | Where-Object { $_.EvaluationState -like "*$($AppEvalState0)*" -or $_.EvaluationState -like "*$($AppEvalState1)*" })
Invoke-WmiMethod -Class CCM_SoftwareUpdatesManager -Name InstallUpdates -ArgumentList ( ,$Application) -Namespace root\ccm\clientsdk -ComputerName $Computer
}
}
Else
{
Foreach ($Computer in $Computername)
{
$Application = (Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_SoftwareUpdate -ComputerName $Computer | Where-Object { $_.EvaluationState -like "*$($AppEvalState)*" -and $_.Name -like "*$($SupName)*" })
Invoke-WmiMethod -Class CCM_SoftwareUpdatesManager -Name InstallUpdates -ArgumentList ( ,$Application) -Namespace root\ccm\clientsdk -ComputerName $Computer
}
}
}
End { }
}
#endregion Source: Globals.ps1
#region Source: MainForm.psf
function Show-MainForm_psf
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
pTcAAB+LCAAAAAAABADVW1tzokwTvrfK/0B58d7ECuIhMfUmVg2IOXwxUVFzuEkhjiwrgi9g0Pz6
r4eDHASFbMzuZqtieg7dT3c/M92QzeUAS/o7NjZt0RIp+MFUdO2qVD1lSq1igaIuHw1FVjRR7Sgq
fhAXuNUVFa2jG4vTpTm7pHem3U2Tn1iyKGuzxFclYWNaeHH6pGhT3TZPyV73e5lKmipTYw9F/bRC
/pUpbqVaKwNfaXhlGaJapnqriapI/8OboT7H2tXk/FxsSI0z5qJWx5XmRYnSAMpVaQb6CNwSJf1Q
1KkBS0ucrlmGrpque4C1Z+hLbFgbbw9aWbogiSpuKwusERyw9KxMMbVL2l96aGtXn+JSqwOWDu7h
VAVrlqB8wIb6eaNM1c6Zg5tIoEst37uDywVLNKyebioWeFNqcWAQG4JkYHx47xCvrVJrgBe6hSlB
n1m2aGDKVbG7mX+HCW8nSSan6iaeBlDfgsFL2lmctPNeF8N7iBhbfZhf7MqydO3oDJs4Zm410xJV
VRj19jEt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NpIy0N1zipIsuH3I4Y4myEB3z6kLndOana+eJtS6eD2NaWJSajzRFL8XwQev
nib1F2ndwh4LgC3edwSnKM4zOdxdxePmYQv3QGlYMnYPfs1K7ArklLqZ2Iv6d0jM5tmeyCdF5TzA
7p6FQ70PvQaYbhd/Qnr4XkoPT84pz7LwHCDDZwd6c7rOw/ImSyOeRjOb7dlD7/OmiYbNNm3ftImM
7BvQ2I3IoK3vj0Am7B6NpC6JD5HZJvFyRuJ4YxP5pB+V4/PFQnwkQYPmWnAssg37nkZmINtElhDB
dgLYRt7MO6xEvI+aRljiaNc7x+vA+zo7C7w/Qc9N3l8HOfVW2ojXiA1YoSHakdtIuoWdYIkmUbgh
UXCjgiXWdi2CzPcIxrbt8K0PNu3rmT/iysGKbDLspwk2zyaM3DveJssOZmBBl9vGi3jtxCvIOWAb
Bn4Trzn76uqS9h6s/dcm8d/Oxd/1BL++PPgLzehrCWSaeDFRFWz6qr2RTWthSrqhKpMvePFwSW+1
xq24rzq+w8aXv045bJH8qdf3GDJEW9Hkz9iq1GaN2fmMYaaNilgTD9t6Xqjf4hOnG/jrDW1Fl/KX
dPjP8lr/Bzk7bJalNwAA#>
#endregion
#----------------------------------------------
#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()
$formMain = New-Object 'System.Windows.Forms.Form'
$buttonInstallSUP = New-Object 'System.Windows.Forms.Button'
$comboboxSUP = New-Object 'System.Windows.Forms.ComboBox'
$labelSoftwareUpdates = New-Object 'System.Windows.Forms.Label'
$buttonInstallApp = New-Object 'System.Windows.Forms.Button'
$comboboxAPP = New-Object 'System.Windows.Forms.ComboBox'
$labelApplications = New-Object 'System.Windows.Forms.Label'
$labelOSDTaskSequence = New-Object 'System.Windows.Forms.Label'
$comboboxOSD = New-Object 'System.Windows.Forms.ComboBox'
$statusbar1 = New-Object 'System.Windows.Forms.StatusBar'
$picturebox1 = New-Object 'System.Windows.Forms.PictureBox'
$buttonInstallOSD = New-Object 'System.Windows.Forms.Button'
$textboxComputername = New-Object 'System.Windows.Forms.TextBox'
$buttonConnect = New-Object 'System.Windows.Forms.Button'
$buttonExit = New-Object 'System.Windows.Forms.Button'
$timerJobTracker = New-Object 'System.Windows.Forms.Timer'
$imagelistButtonBusyAnimation = New-Object 'System.Windows.Forms.ImageList'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
#region Control Helper Functions
function Load-ComboBox
{
<#
.SYNOPSIS
This functions helps you load items into a ComboBox.
.DESCRIPTION
Use this function to dynamically load items into the ComboBox control.
.PARAMETER ComboBox
The ComboBox control you want to add items to.
.PARAMETER Items
The object or objects you wish to load into the ComboBox's Items collection.
.PARAMETER DisplayMember
Indicates the property to display for the items in this control.
.PARAMETER Append
Adds the item(s) to the ComboBox without clearing the Items collection.
.EXAMPLE
Load-ComboBox $combobox1 "Red", "White", "Blue"
.EXAMPLE
Load-ComboBox $combobox1 "Red" -Append
Load-ComboBox $combobox1 "White" -Append
Load-ComboBox $combobox1 "Blue" -Append
.EXAMPLE
Load-ComboBox $combobox1 (Get-Process) "ProcessName"
#>
Param (
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
[System.Windows.Forms.ComboBox]$ComboBox,
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
$Items,
[Parameter(Mandatory=$false)]
[string]$DisplayMember,
[switch]$Append
)
if(-not $Append)
{
$ComboBox.Items.Clear()
}
if($Items -is [Object[]])
{
$ComboBox.Items.AddRange($Items)
}
elseif ($Items -is [System.Collections.IEnumerable])
{
$ComboBox.BeginUpdate()
foreach($obj in $Items)
{
$ComboBox.Items.Add($obj)
}
$ComboBox.EndUpdate()
}
else
{
$ComboBox.Items.Add($Items)
}
$ComboBox.DisplayMember = $DisplayMember
}
function Load-ListBox
{
<#
.SYNOPSIS
This functions helps you load items into a ListBox or CheckedListBox.
.DESCRIPTION
Use this function to dynamically load items into the ListBox control.
.PARAMETER ListBox
The ListBox control you want to add items to.
.PARAMETER Items
The object or objects you wish to load into the ListBox's Items collection.
.PARAMETER DisplayMember
Indicates the property to display for the items in this control.
.PARAMETER Append
Adds the item(s) to the ListBox without clearing the Items collection.
.EXAMPLE
Load-ListBox $ListBox1 "Red", "White", "Blue"
.EXAMPLE
Load-ListBox $listBox1 "Red" -Append
Load-ListBox $listBox1 "White" -Append
Load-ListBox $listBox1 "Blue" -Append
.EXAMPLE
Load-ListBox $listBox1 (Get-Process) "ProcessName"
#>
Param (
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
[System.Windows.Forms.ListBox]$ListBox,
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
$Items,
[Parameter(Mandatory=$false)]
[string]$DisplayMember,
[switch]$Append
)
if(-not $Append)
{
$listBox.Items.Clear()
}
if($Items -is [System.Windows.Forms.ListBox+ObjectCollection])
{
$listBox.Items.AddRange($Items)
}
elseif ($Items -is [Array])
{
$listBox.BeginUpdate()
foreach($obj in $Items)
{
$listBox.Items.Add($obj)
}
$listBox.EndUpdate()
}
else
{
$listBox.Items.Add($Items)
}
$listBox.DisplayMember = $DisplayMember
}
function Load-DataGridView
{
<#
.SYNOPSIS
This functions helps you load items into a DataGridView.
.DESCRIPTION
Use this function to dynamically load items into the DataGridView control.
.PARAMETER DataGridView
The DataGridView control you want to add items to.
.PARAMETER Item
The object or objects you wish to load into the DataGridView's items collection.
.PARAMETER DataMember
Sets the name of the list or table in the data source for which the DataGridView is displaying data.
.PARAMETER AutoSizeColumns
Resizes DataGridView control's columns after loading the items.
#>
Param (
[ValidateNotNull()]
[Parameter(Mandatory = $true)]
[System.Windows.Forms.DataGridView]$DataGridView,
[ValidateNotNull()]
[Parameter(Mandatory = $true)]
$Item,
[Parameter(Mandatory = $false)]
[string]$DataMember,
[System.Windows.Forms.DataGridViewAutoSizeColumnMode]$AutoSizeColumns = 'None'
)
$DataGridView.SuspendLayout()
$DataGridView.DataMember = $DataMember
if ($Item -is [System.Data.DataSet] -and $Item.Tables.Count -gt 0)
{
$DataGridView.DataSource = $Item.Tables[0]
}
elseif ($Item -is [System.ComponentModel.IListSource]`
-or $Item -is [System.ComponentModel.IBindingList] -or $Item -is [System.ComponentModel.IBindingListView])
{
$DataGridView.DataSource = $Item
}
else
{
$array = New-Object System.Collections.ArrayList
if ($Item -is [System.Collections.IList])
{
$array.AddRange($Item)
}
else
{
$array.Add($Item)
}
$DataGridView.DataSource = $array
}
if ($AutoSizeColumns -ne 'None')
{
$DataGridView.AutoResizeColumns($AutoSizeColumns)
}
$DataGridView.ResumeLayout()
}
function ConvertTo-DataTable
{
<#
.SYNOPSIS
Converts objects into a DataTable.
.DESCRIPTION
Converts objects into a DataTable, which are used for DataBinding.
.PARAMETER InputObject
The input to convert into a DataTable.
.PARAMETER Table
The DataTable you wish to load the input into.
.PARAMETER RetainColumns
This switch tells the function to keep the DataTable's existing columns.
.PARAMETER FilterWMIProperties
This switch removes WMI properties that start with an underline.
.EXAMPLE
$DataTable = ConvertTo-DataTable -InputObject (Get-Process)
#>
[OutputType([System.Data.DataTable])]
param (
[ValidateNotNull()]
$InputObject,
[ValidateNotNull()]
[System.Data.DataTable]$Table,
[switch]$RetainColumns,
[switch]$FilterWMIProperties)
if ($null -eq $Table)
{
$Table = New-Object System.Data.DataTable
}
if ($InputObject -is [System.Data.DataTable])
{
$Table = $InputObject
}
elseif ($InputObject -is [System.Data.DataSet] -and $InputObject.Tables.Count -gt 0)
{
$Table = $InputObject.Tables[0]
}
else
{
if (-not $RetainColumns -or $Table.Columns.Count -eq 0)
{
#Clear out the Table Contents
$Table.Clear()
if ($null -eq $InputObject) { return } #Empty Data
$object = $null
#find the first non null value
foreach ($item in $InputObject)
{
if ($null -ne $item)
{
$object = $item
break
}
}
if ($null -eq $object) { return } #All null then empty
#Get all the properties in order to create the columns
foreach ($prop in $object.PSObject.Get_Properties())
{
if (-not $FilterWMIProperties -or -not $prop.Name.StartsWith('__')) #filter out WMI properties
{
#Get the type from the Definition string
$type = $null
if ($null -ne $prop.Value)
{
try { $type = $prop.Value.GetType() }
catch { }
}
if ($null -ne $type) # -and [System.Type]::GetTypeCode($type) -ne 'Object')
{
[void]$table.Columns.Add($prop.Name, $type)
}
else #Type info not found
{
[void]$table.Columns.Add($prop.Name)
}
}
}
if ($object -is [System.Data.DataRow])
{
foreach ($item in $InputObject)
{
$Table.Rows.Add($item)
}
return @( ,$Table)
}
}
else
{
$Table.Rows.Clear()
}
foreach ($item in $InputObject)
{
$row = $table.NewRow()
if ($item)
{
foreach ($prop in $item.PSObject.Get_Properties())
{
if ($table.Columns.Contains($prop.Name))
{
$row.Item($prop.Name) = $prop.Value
}
}
}
[void]$table.Rows.Add($row)
}
}
return @( ,$Table)
}
#endregion
#region Search Function
function SearchGrid()
{
$RowIndex = 0
$ColumnIndex = 0
$seachString = $textboxComputername.Text
if($seachString -eq "")
{
return
}
if($datagridviewResults.SelectedCells.Count -ne 0)
{
$startCell = $datagridviewResults.SelectedCells[0];
$RowIndex = $startCell.RowIndex
$ColumnIndex = $startCell.ColumnIndex + 1
}
$columnCount = $datagridviewResults.ColumnCount
$rowCount = $datagridviewResults.RowCount
for(;$RowIndex -lt $rowCount; $RowIndex++)
{
$Row = $datagridviewResults.Rows[$RowIndex]
for(;$ColumnIndex -lt $columnCount; $ColumnIndex++)
{
$cell = $Row.Cells[$ColumnIndex]
if($null -ne $cell.Value -and $cell.Value.ToString().IndexOf($seachString, [StringComparison]::OrdinalIgnoreCase) -ne -1)
{
$datagridviewResults.CurrentCell = $cell
return
}
}
$ColumnIndex = 0
}
$datagridviewResults.CurrentCell = $null
[void][System.Windows.Forms.MessageBox]::Show("The search has reached the end of the grid.","String not Found")
}
#endregion
$formMain_Load={
#TODO: Initialize Form Controls here
}
$buttonExit_Click={
#TODO: Place custom script here
$formMain.Close()
}
$buttonConnect_Click={
#TODO: Place custom script here
try
{
$Empty = ""
Load-ComboBox $comboboxOSD $Empty
$comboboxOSD.SelectedIndex = 0
Load-ComboBox $comboboxAPP $Empty
$comboboxAPP.SelectedIndex = 0
Load-ComboBox $comboboxSUP $Empty
$comboboxSUP.SelectedIndex = 0
if (-not $textboxComputername.Text)
{
[System.Windows.Forms.MessageBox]::Show('No computer specified', 'Error')
Throw 'No Computer specified'
}
else
{
$global:Computername = $textboxComputername.Text
}
Write-Status -Message "Connecting to $computername"
$picturebox1.BackColor = "Gold"
If (-not (Test-Connection -ComputerName $Computername -Count 1 -Quiet))
{
$picturebox1.BackColor = "Red"
[System.Windows.Forms.MessageBox]::Show('No such computer or computer is offline', 'Error')
Throw 'No such computer or computer is offline'
}
Else
{
Write-status -Message "Connected to $Computername"
$picturebox1.BackColor = "Green"
# OSD Task Sequence #
$OSDTS = (Get-CimInstance -ClassName CCM_Program -Namespace "root\ccm\clientSDK" -ComputerName $Computername | Where-Object { $_.TaskSequence -like "True" })
$OSD = $OSDTS.Name
# Application #
$Application = (Get-CimInstance -ClassName CCM_Application -Namespace "root\ccm\clientSDK" -ComputerName $Computername | Where-Object { $_.InstallState -like "NotInstalled" })
$AppName = $Application.Name
# Software Updates #
$SUPEvalState0 = "0"
$SUPEvalState1 = "1"
$SUPClass = [WmiClass]"root\ccm\clientSDK:CCM_SoftwareUpdatesManager"
$SUPs = (Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_SoftwareUpdate -ComputerName $Computername | Where-Object { $_.EvaluationState -like "*$($SUPEvalState0)*" -or $_.EvaluationState -like "*$($SUPEvalState1)*" })
$SUPName = $SUPs.Name
if ($OSD)
{
Load-ComboBox $comboboxOSD $OSD -Append
$comboboxOSD.SelectedIndex = 1
}
if ($APPName)
{
Load-ComboBox $comboboxAPP $AppName -Append
$comboboxAPP.SelectedIndex = 1
}
if ($SUPName)
{
Load-ComboBox $comboboxSUP $SUPName -Append
$comboboxSUP.SelectedIndex = 1
}
} #Else
} #IF
Catch
{
Write-Status -Message $_.Exception.Message
}
}
$formMain_FormClosed=[System.Windows.Forms.FormClosedEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.FormClosedEventArgs]
#Stop any pending jobs
Stop-JobTracker
}
$timerJobTracker_Tick={
Update-JobTracker
}
#region Job Tracker
$JobTrackerList = New-Object System.Collections.ArrayList
function Add-JobTracker
{
<#
.SYNOPSIS
Add a new job to the JobTracker and starts the timer.
.DESCRIPTION
Add a new job to the JobTracker and starts the timer.
.PARAMETER Name
The name to assign to the Job
.PARAMETER JobScript
The script block that the Job will be performing.
Important: Do not access form controls from this script block.
.PARAMETER ArgumentList
The arguments to pass to the job
.PARAMETER CompleteScript
The script block that will be called when the job is complete.
The job is passed as an argument. The Job argument is null when the job fails.
.PARAMETER UpdateScript
The script block that will be called each time the timer ticks.
The job is passed as an argument. Use this to get the Job's progress.
.EXAMPLE
Add-JobTracker -Name 'JobName' `
-JobScript {
Param($Argument1)#Pass any arguments using the ArgumentList parameter
#Important: Do not access form controls from this script block.
Get-WmiObject Win32_Process -Namespace "root\CIMV2"
}`
-CompletedScript {
Param($Job)
$results = Receive-Job -Job $Job
}`
-UpdateScript {
Param($Job)
#$results = Receive-Job -Job $Job -Keep
}
.LINK
#>
Param(
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
[string]$Name,
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
[ScriptBlock]$JobScript,
$ArgumentList = $null,
[ScriptBlock]$CompletedScript,
[ScriptBlock]$UpdateScript)
#Start the Job
$job = Start-Job -Name $Name -ScriptBlock $JobScript -ArgumentList $ArgumentList
if($null -ne $job)
{
#Create a Custom Object to keep track of the Job & Script Blocks
$members = @{ 'Job' = $Job;
'CompleteScript' = $CompletedScript;
'UpdateScript' = $UpdateScript}
$psObject = New-Object System.Management.Automation.PSObject -Property $members
[void]$JobTrackerList.Add($psObject)
#Start the Timer
if(-not $timerJobTracker.Enabled)
{
$timerJobTracker.Start()
}
}
elseif($null -ne $CompletedScript)
{
#Failed
Invoke-Command -ScriptBlock $CompletedScript -ArgumentList $null
}
}
function Update-JobTracker
{
<#
.SYNOPSIS
Checks the status of each job on the list.
#>
#Poll the jobs for status updates
$timerJobTracker.Stop() #Freeze the Timer
for($index =0; $index -lt $JobTrackerList.Count; $index++)
{
$psObject = $JobTrackerList[$index]
if($null -ne $psObject)
{
if($null -ne $psObject.Job)
{
if($psObject.Job.State -ne "Running")
{
#Call the Complete Script Block
if($null -ne $psObject.CompleteScript)
{
#$results = Receive-Job -Job $psObject.Job
Invoke-Command -ScriptBlock $psObject.CompleteScript -ArgumentList $psObject.Job
}
$JobTrackerList.RemoveAt($index)
Remove-Job -Job $psObject.Job
$index-- #Step back so we don't skip a job
}
elseif($null -ne $psObject.UpdateScript)
{
#Call the Update Script Block
Invoke-Command -ScriptBlock $psObject.UpdateScript -ArgumentList $psObject.Job
}
}
}
else
{
$JobTrackerList.RemoveAt($index)
$index-- #Step back so we don't skip a job
}
}
if($JobTrackerList.Count -gt 0)
{
$timerJobTracker.Start()#Resume the timer
}
}
function Stop-JobTracker
{
<#
.SYNOPSIS
Stops and removes all Jobs from the list.
#>
#Stop the timer
$timerJobTracker.Stop()
#Remove all the jobs
while($JobTrackerList.Count -gt 0)
{
$job = $JobTrackerList[0].Job
$JobTrackerList.RemoveAt(0)
Stop-Job $job
Remove-Job $job
}
}
#endregion
$textboxComputername_KeyDown=[System.Windows.Forms.KeyEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.KeyEventArgs]
if($_.KeyCode -eq 'Enter' -and $buttonConnect.Enabled)
{
#SearchGrid
try
{
$Empty = ""
Load-ComboBox $comboboxOSD $Empty
$comboboxOSD.SelectedIndex = 0
Load-ComboBox $comboboxAPP $Empty
$comboboxAPP.SelectedIndex = 0
Load-ComboBox $comboboxSUP $Empty
$comboboxSUP.SelectedIndex = 0
if (-not $textboxComputername.Text)
{
[System.Windows.Forms.MessageBox]::Show('No computer specified', 'Error')
Throw 'No Computer specified'
}
else
{
$global:Computername = $textboxComputername.Text
}
Write-Status -Message "Connecting to $computername"
$picturebox1.BackColor = "Gold"
If (-not (Test-Connection -ComputerName $Computername -Count 1 -Quiet))
{
$picturebox1.BackColor = "Red"
[System.Windows.Forms.MessageBox]::Show('No such Computer or computer is offline', 'Error')
Throw 'No such Computer or computer is offline'
}
Else
{
Write-status -Message "Connected to $Computername"
$picturebox1.BackColor = "Green"
# OSD Task Sequence #
$OSDTS = (Get-CimInstance -ClassName CCM_Program -Namespace "root\ccm\clientSDK" -ComputerName $Computername | Where-Object { $_.TaskSequence -like "True" })
$OSD = $OSDTS.Name
# Application #
$Application = (Get-CimInstance -ClassName CCM_Application -Namespace "root\ccm\clientSDK" -ComputerName $Computername | Where-Object { $_.InstallState -like "NotInstalled" })
$AppName = $Application.Name
# Software Updates #
$SUPEvalState0 = "0"
$SUPEvalState1 = "1"
$SUPClass = [WmiClass]"root\ccm\clientSDK:CCM_SoftwareUpdatesManager"
$SUPs = (Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_SoftwareUpdate -ComputerName $Computername | Where-Object { $_.EvaluationState -like "*$($SUPEvalState0)*" -or $_.EvaluationState -like "*$($SUPEvalState1)*" })
$SUPName = $SUPs.Name
if ($OSD)
{
Load-ComboBox $comboboxOSD $OSD -Append
$comboboxOSD.SelectedIndex = 1
}
if ($APPName)
{
Load-ComboBox $comboboxAPP $AppName -Append
$comboboxAPP.SelectedIndex = 1
}
if ($SUPName)
{
Load-ComboBox $comboboxSUP $SUPName -Append
$comboboxSUP.SelectedIndex = 1
}
} #Else
} #IF
Catch
{
Write-Status -Message $_.Exception.Message
}
$_.SuppressKeyPress = $true
}
}
$textboxComputername_TextChanged={
#TODO: Place custom script here
}
$statusbar1_PanelClick=[System.Windows.Forms.StatusBarPanelClickEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.StatusBarPanelClickEventArgs]
#TODO: Place custom script here
}
$toolstripstatuslabel1_Click={
#TODO: Place custom script here
}
$comboboxOSD_SelectedIndexChanged={
#TODO: Place custom script here
}
$labelOSDTaskSequence_Click={
#TODO: Place custom script here
}
$comboboxAPP_SelectedIndexChanged={
#TODO: Place custom script here
}
$buttonInstallOSD_Click={
#TODO: Place custom script here
Invoke-OSDInstall -Computername $Computername -OSDName $comboboxOSD.SelectedItem
}
$buttonInstallApp_Click={
#TODO: Place custom script here
Invoke-AppInstall -Computername $Computername -Method Install -AppName $comboboxAPP.SelectedItem
}
$buttonInstallSUP_Click={
#TODO: Place custom script here
Invoke-SupInstall -Computername $Computername -SupName $comboboxSUP.SelectedItem
}
$buttonCancelProcess_Click={
$script:CancelLoop = $true
}
$buttonStartProcess_Click={
#Init CancelLoop
$script:CancelLoop = $false
$buttonCancelProcess.Enabled = $true
#Disable the button so we don't trigger it again
$this.Enabled = $false
#Reset the Progress Bar
$progressbar1.Value = 0
for($i = 0; $i -lt $progressbar1.Maximum; $i++)
{
#----------------------------------------
#Place custom script here
sleep -Milliseconds 200
#----------------------------------------
#process the pending message
[System.Windows.Forms.Application]::DoEvents()
if($script:CancelLoop -eq $true)
{
#Clear the progress bar
$progressbar1.Value = 0
#Exit the loop
break;
}
#Step the progress bar
$progressbar1.PerformStep()
}
#Enable the button so we can click it again
$this.Enabled = $true
$buttonCancelProcess.Enabled = $false
}
$buttonRunProcess_Click={
$buttonRunProcess.Enabled = $false
#TODO: Set the process path there
Add-ProcessTracker -FilePath "$env:windir/System32/notepad.exe" `
-CompletedScript {
$buttonRunProcess.Enabled = $true
$buttonRunProcess.ImageIndex = -1
}`
-UpdateScript {
#Animate the Button
if($null -ne $buttonRunProcess.ImageList)
{
if($buttonRunProcess.ImageIndex -lt $buttonRunProcess.ImageList.Images.Count - 1)
{
$buttonRunProcess.ImageIndex += 1
}
else
{
$buttonRunProcess.ImageIndex = 0
}
}
}
}
$processTracker_FormClosed=[System.Windows.Forms.FormClosedEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.FormClosedEventArgs]
#Stop any pending processes
#Stop-ProcessTracker
}
$timerProcessTracker_Tick={
Update-ProcessTracker
}
#region Process Tracker
$ProcessTrackerList = New-Object System.Collections.ArrayList
function Add-ProcessTracker
{
<#
.SYNOPSIS
Add a new process to the ProcessTracker and starts the timer.
.DESCRIPTION
Add a new process to the ProcessTracker and starts the timer.
.PARAMETER FilePath
The path to executable.
.PARAMETER ArgumentList
The arguments to pass to the process.
.PARAMETER CompleteScript
The script block that will be called when the process is complete.
The process is passed as an argument. The process argument is null when the job fails.
.PARAMETER UpdateScript
The script block that will be called each time the timer ticks.
The process is passed as an argument.
.EXAMPLE
Add-ProcessTracker -FilePath "$env:windir/System32/notepad.exe" `
-CompletedScript {
Param([System.Diagnostics.Process]$Process)
$button.Enable = $true
}`
-UpdateScript {
Param([System.Diagnostics.Process]$Process)
Function-Animate $button
}
.LINK
#>
Param(
[ValidateNotNull()]
[Parameter(Mandatory=$true)]
[string]$FilePath,
$ArgumentList = $null,
[ScriptBlock]$CompletedScript,
[ScriptBlock]$UpdateScript)
#Start the Job
if($ArgumentList)
{
$process = Start-Process -FilePath $FilePath -ArgumentList $ArgumentList -PassThru
}
else
{
$process = Start-Process -FilePath $FilePath -PassThru
}
if($null -ne $process)
{
#Create a Custom Object to keep track of the Job & Script Blocks
$members = @{ "Process" = $process;
"CompleteScript" = $CompletedScript;
"UpdateScript" = $UpdateScript}
$psObject = New-Object System.Management.Automation.PSObject -Property $members
[void]$ProcessTrackerList.Add($psObject)
#Start the Timer
if(-not $timerProcessTracker.Enabled)
{
$timerProcessTracker.Start()
}
}
elseif($null -ne $CompletedScript)
{
#Failed
Invoke-Command -ScriptBlock $CompletedScript -ArgumentList $null
}
}
function Update-ProcessTracker
{
<#
.SYNOPSIS
Checks the status of each job on the list.
#>
#Poll the jobs for status updates
$timerProcessTracker.Stop() #Freeze the Timer
for($index =0; $index -lt $ProcessTrackerList.Count; $index++)
{
$psObject = $ProcessTrackerList[$index]
if($null -ne $psObject)
{
if($null -ne $psObject.Process)
{
if($psObject.Process.HasExited)
{
#Call the Complete Script Block
if($null -ne $psObject.CompleteScript)
{
#$results = Receive-Job -Job $psObject.Job
Invoke-Command -ScriptBlock $psObject.CompleteScript -ArgumentList $psObject.Process
}
$ProcessTrackerList.RemoveAt($index)
$index-- #Step back so we don't skip a job
}
elseif($null -ne $psObject.UpdateScript)
{
#Call the Update Script Block
Invoke-Command -ScriptBlock $psObject.UpdateScript -ArgumentList $psObject.Process
}
}
}
else
{
$ProcessTrackerList.RemoveAt($index)
$index-- #Step back so we don't skip a job
}
}
if($ProcessTrackerList.Count -gt 0)
{
$timerProcessTracker.Start()#Resume the timer
}
}
function Stop-ProcessTracker
{
<#
.SYNOPSIS
Stops and removes all processes from the list.
#>
#Stop the timer
$timerProcessTracker.Stop()
#Remove all the processes
while($ProcessTrackerList.Count -gt 0)
{
$process = $ProcessTrackerList[0].Process
$ProcessTrackerList.RemoveAt(0)
if(-not $psObject.Process.HasExited)
{
Stop-Process -InputObject $process
}
}
}
#endregion
# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$formMain.WindowState = $InitialFormWindowState
}
$Form_StoreValues_Closing=
{
#Store the control values
$script:MainForm_comboboxSUP = $comboboxSUP.Text
$script:MainForm_comboboxSUP_SelectedItem = $comboboxSUP.SelectedItem
$script:MainForm_comboboxAPP = $comboboxAPP.Text
$script:MainForm_comboboxAPP_SelectedItem = $comboboxAPP.SelectedItem
$script:MainForm_comboboxOSD = $comboboxOSD.Text
$script:MainForm_comboboxOSD_SelectedItem = $comboboxOSD.SelectedItem
$script:MainForm_textboxComputername = $textboxComputername.Text
}
$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$buttonInstallSUP.remove_Click($buttonInstallSUP_Click)
$buttonInstallApp.remove_Click($buttonInstallApp_Click)
$comboboxAPP.remove_SelectedIndexChanged($comboboxAPP_SelectedIndexChanged)
$labelOSDTaskSequence.remove_Click($labelOSDTaskSequence_Click)
$comboboxOSD.remove_SelectedIndexChanged($comboboxOSD_SelectedIndexChanged)
$buttonInstallOSD.remove_Click($buttonInstallOSD_Click)
$textboxComputername.remove_TextChanged($textboxComputername_TextChanged)
$textboxComputername.remove_KeyDown($textboxComputername_KeyDown)
$buttonConnect.remove_Click($buttonConnect_Click)
$buttonExit.remove_Click($buttonExit_Click)
$formMain.remove_FormClosed($formMain_FormClosed)
$formMain.remove_Load($formMain_Load)
$timerJobTracker.remove_Tick($timerJobTracker_Tick)
$formMain.remove_Load($Form_StateCorrection_Load)
$formMain.remove_Closing($Form_StoreValues_Closing)
$formMain.remove_FormClosed($Form_Cleanup_FormClosed)
}
catch { Out-Null <# Prevent PSScriptAnalyzer warning #> }
}
#endregion Generated Events
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
$formMain.SuspendLayout()
#
# formMain
#
$formMain.Controls.Add($buttonInstallSUP)
$formMain.Controls.Add($comboboxSUP)
$formMain.Controls.Add($labelSoftwareUpdates)
$formMain.Controls.Add($buttonInstallApp)
$formMain.Controls.Add($comboboxAPP)
$formMain.Controls.Add($labelApplications)
$formMain.Controls.Add($labelOSDTaskSequence)
$formMain.Controls.Add($comboboxOSD)
$formMain.Controls.Add($statusbar1)
$formMain.Controls.Add($picturebox1)
$formMain.Controls.Add($buttonInstallOSD)
$formMain.Controls.Add($textboxComputername)
$formMain.Controls.Add($buttonConnect)
$formMain.Controls.Add($buttonExit)
$formMain.AutoScaleDimensions = '6, 13'
$formMain.AutoScaleMode = 'Font'
$formMain.ClientSize = '475, 371'
$formMain.Name = 'formMain'
$formMain.StartPosition = 'CenterScreen'
$formMain.Text = 'Remote Software Center'
$formMain.add_FormClosed($formMain_FormClosed)
$formMain.add_Load($formMain_Load)
#
# buttonInstallSUP
#
$buttonInstallSUP.Anchor = 'Bottom, Left'
$buttonInstallSUP.Location = '362, 229'
$buttonInstallSUP.Name = 'buttonInstallSUP'
$buttonInstallSUP.Size = '75, 23'
$buttonInstallSUP.TabIndex = 16
$buttonInstallSUP.Text = '&Install SUP'
$buttonInstallSUP.TextImageRelation = 'ImageBeforeText'
$buttonInstallSUP.UseVisualStyleBackColor = $True
$buttonInstallSUP.add_Click($buttonInstallSUP_Click)
#
# comboboxSUP
#
$comboboxSUP.FormattingEnabled = $True
$comboboxSUP.Location = '11, 229'
$comboboxSUP.Name = 'comboboxSUP'
$comboboxSUP.Size = '308, 21'
$comboboxSUP.TabIndex = 15
#
# labelSoftwareUpdates
#
$labelSoftwareUpdates.AutoSize = $True
$labelSoftwareUpdates.Font = 'Microsoft Sans Serif, 9pt, style=Bold'
$labelSoftwareUpdates.Location = '11, 211'
$labelSoftwareUpdates.Name = 'labelSoftwareUpdates'
$labelSoftwareUpdates.Size = '120, 15'
$labelSoftwareUpdates.TabIndex = 14
$labelSoftwareUpdates.Text = 'Software Updates'
#
# buttonInstallApp
#
$buttonInstallApp.Anchor = 'Bottom, Left'
$buttonInstallApp.Location = '362, 157'
$buttonInstallApp.Name = 'buttonInstallApp'
$buttonInstallApp.Size = '75, 23'
$buttonInstallApp.TabIndex = 13
$buttonInstallApp.Text = '&Install App'
$buttonInstallApp.TextImageRelation = 'ImageBeforeText'
$buttonInstallApp.UseVisualStyleBackColor = $True
$buttonInstallApp.add_Click($buttonInstallApp_Click)
#
# comboboxAPP
#
$comboboxAPP.FormattingEnabled = $True
$comboboxAPP.Location = '11, 157'
$comboboxAPP.Name = 'comboboxAPP'
$comboboxAPP.Size = '308, 21'
$comboboxAPP.TabIndex = 12
$comboboxAPP.add_SelectedIndexChanged($comboboxAPP_SelectedIndexChanged)
#
# labelApplications
#
$labelApplications.AutoSize = $True
$labelApplications.Font = 'Microsoft Sans Serif, 9pt, style=Bold'
$labelApplications.Location = '11, 139'
$labelApplications.Name = 'labelApplications'
$labelApplications.Size = '85, 15'
$labelApplications.TabIndex = 11
$labelApplications.Text = 'Applications'
#
# labelOSDTaskSequence
#
$labelOSDTaskSequence.AutoSize = $True
$labelOSDTaskSequence.Font = 'Microsoft Sans Serif, 9pt, style=Bold'
$labelOSDTaskSequence.Location = '14, 72'
$labelOSDTaskSequence.Name = 'labelOSDTaskSequence'
$labelOSDTaskSequence.Size = '138, 15'
$labelOSDTaskSequence.TabIndex = 10
$labelOSDTaskSequence.Text = 'OSD Task Sequence'
$labelOSDTaskSequence.add_Click($labelOSDTaskSequence_Click)
#
# comboboxOSD
#
$comboboxOSD.FormattingEnabled = $True
$comboboxOSD.Location = '11, 90'
$comboboxOSD.Name = 'comboboxOSD'
$comboboxOSD.Size = '308, 21'
$comboboxOSD.TabIndex = 9
$comboboxOSD.add_SelectedIndexChanged($comboboxOSD_SelectedIndexChanged)
#
# statusbar1
#
$statusbar1.Location = '0, 349'
$statusbar1.Name = 'statusbar1'
$statusbar1.Size = '475, 22'
$statusbar1.TabIndex = 8
#
# picturebox1
#
$picturebox1.BackColor = 'Transparent'
$picturebox1.Location = '0, 320'
$picturebox1.Name = 'picturebox1'
$picturebox1.Size = '25, 27'
$picturebox1.TabIndex = 7
$picturebox1.TabStop = $False
#
# buttonInstallOSD
#
$buttonInstallOSD.Anchor = 'Bottom, Left'
$buttonInstallOSD.ImageList = $imagelistButtonBusyAnimation
$buttonInstallOSD.Location = '362, 90'
$buttonInstallOSD.Name = 'buttonInstallOSD'
$buttonInstallOSD.Size = '75, 23'
$buttonInstallOSD.TabIndex = 0
$buttonInstallOSD.Text = '&Install OSD'
$buttonInstallOSD.TextImageRelation = 'ImageBeforeText'
$buttonInstallOSD.UseVisualStyleBackColor = $True
$buttonInstallOSD.add_Click($buttonInstallOSD_Click)
#
# textboxComputername
#
$textboxComputername.Anchor = 'Top, Left, Right'
$textboxComputername.Location = '13, 15'
$textboxComputername.Name = 'textboxComputername'
$textboxComputername.Size = '118, 20'
$textboxComputername.TabIndex = 0
$textboxComputername.add_TextChanged($textboxComputername_TextChanged)
$textboxComputername.add_KeyDown($textboxComputername_KeyDown)
#
# buttonConnect
#
$buttonConnect.Anchor = 'Top, Right'
$buttonConnect.Location = '150, 12'
$buttonConnect.Name = 'buttonConnect'
$buttonConnect.Size = '75, 23'
$buttonConnect.TabIndex = 1
$buttonConnect.Text = '&Connect'
$buttonConnect.UseVisualStyleBackColor = $True
$buttonConnect.add_Click($buttonConnect_Click)
#
# buttonExit
#
$buttonExit.Anchor = 'Bottom, Right'
$buttonExit.Location = '362, 320'
$buttonExit.Name = 'buttonExit'
$buttonExit.Size = '75, 23'
$buttonExit.TabIndex = 4
$buttonExit.Text = 'E&xit'
$buttonExit.UseVisualStyleBackColor = $True
$buttonExit.add_Click($buttonExit_Click)
#
# timerJobTracker
#
$timerJobTracker.add_Tick($timerJobTracker_Tick)
#
# imagelistButtonBusyAnimation
#
$Formatter_binaryFomatter = New-Object System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
#region Binary Data
$System_IO_MemoryStream = New-Object System.IO.MemoryStream (,[byte[]][System.Convert]::FromBase64String('
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAu
MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAA
ACZTeXN0ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkD
AAAADwMAAAB2CgAAAk1TRnQBSQFMAgEBCAEAAbgBAAG4AQABEAEAARABAAT/ASEBAAj/AUIBTQE2
BwABNgMAASgDAAFAAwABMAMAAQEBAAEgBgABMP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/
AP8AugADwgH/AzUB/wM1Af8DwgH/MAADwgH/A1UB/wOCAf8DwgH/s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/wH8AT8B/AE/BP8B/AE/Af4BfwT/AfwBPwH+AX8E/wH8AT8B
/AE/BP8BwAEnAcABPwHnA/8BwAEDAcIBfwHDA/8DwwH/AcMD/wHDAecBwwH/AecD/wEPAf8BDwH/
AQ8B/wGfAf8BDwH/AQ8B/wEPAf8BDwH/AQ8B/wEPAf8BDwH/AQ8B/wEPAf8BDwH/AQ8B/wGfA/8B
wwH/AcMB/wLDAv8BwwH/AcMB/wLDAv8BwwH/AcABPwHAAQMC/wHDAf8BwAE/AcABAwT/AfwBPwH8
AT8E/wH8AT8B/AE/Cw=='))
#endregion
$imagelistButtonBusyAnimation.ImageStream = $Formatter_binaryFomatter.Deserialize($System_IO_MemoryStream)
$Formatter_binaryFomatter = $null
$System_IO_MemoryStream = $null
$imagelistButtonBusyAnimation.TransparentColor = 'Transparent'
$formMain.ResumeLayout()
#endregion Generated Form Code
#----------------------------------------------
#Save the initial state of the form
$InitialFormWindowState = $formMain.WindowState
#Init the OnLoad event to correct the initial state of the form
$formMain.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$formMain.add_FormClosed($Form_Cleanup_FormClosed)
#Store the control values when form is closing
$formMain.add_Closing($Form_StoreValues_Closing)
#Show the Form
return $formMain.ShowDialog()
}
#endregion Source: MainForm.psf
#Start the application
Main ($CommandLine)