Powershell GUI ConfigMgr to create AD Groups and Deployments

Target: Create AD-Groups for Installation / Uninstallation then create Installation/Uninstallation device collection in ConfigMgr and create the deployment for the application

New Version published. Download here
One version which runs with remote PowerShell like the first version.

And one version which runs localy. Prerequisites SCCM-Console installed / and the Windows Remote-Tools / Active Directory

1

The new version includes a few bug fixes and a few new tabs. To deploy multiple applications.

2017-11-17 17_52_48-2.png ‎- Fotos

 

Prerequisites: Permission on Active-Directory and SCCM to create collections -> run the .exe as different user as required, Active-Directory Powershell extension, Modify the xml-file

This is my first Powershell GUI that I’ll share – I’m not a PowerShell Pro so please be fair.

Run the .ps1 file with a user with write-permission in AD and the permission to create device collections and deployments in ConfigMgr.

Enter the Name of the Group to create in AD:

Click on OU: an Active-Directory Popup will appear to select the required OU / you can also create new OU’s:

Same for the Uninstallation Group:

Once finsihed click on Next:

On the next page you need to enter the application you want to deploy / just click in the windows and it’ll query all available Applications from  ConfigMgr:

In the Grid-View you can use Filter/Search:

Select the Deployment Type (Avaialbe, Required) and once the deployment should be go live:

Then you can select Finish and the Progress-Bar will run:

The result in Active Directory and ConfigMgr:

In ConfigMgr:

The AD-Group Query in the created device collection:

The Deployments:

The program already has some error handling / in step1 there is a check if the group name is already in use:

Also it checks if it can connect to the ConfigMgr and if Active-Directory Module is installed:

Modify the XML-File with your data – this will be loaded on .exe startup:

Powershell GUI ConfigMgr to create AD Groups and Deployments

Target: Create AD-Groups for Installation / Uninstallation then create Installation/Uninstallation device collection in ConfigMgr and create the deployment for the application

Prerequisites: Permission on Active-Directory and SCCM to create collections -> run the .exe as different user as required, Active-Directory Powershell extension, Modify the xml-file

This is my first Powershell GUI that I’ll share – I’m not a PowerShell Pro so please be fair.

Run the .ps1 file with a user with write-permission in AD and the permission to create device collections and deployments in ConfigMgr.

Enter the Name of the Group to create in AD:

Click on OU: an Active-Directory Popup will appear to select the required OU / you can also create new OU’s:

Same for the Uninstallation Group:

Once finsihed click on Next:

On the next page you need to enter the application you want to deploy / just click in the windows and it’ll query all available Applications from  ConfigMgr:

In the Grid-View you can use Filter/Search:

Select the Deployment Type (Avaialbe, Required) and once the deployment should be go live:

Then you can select Finish and the Progress-Bar will run:

The result in Active Directory and ConfigMgr:

In ConfigMgr:

The AD-Group Query in the created device collection:

The Deployments:

The program already has some error handling / in step1 there is a check if the group name is already in use:

Also it checks if it can connect to the ConfigMgr and if Active-Directory Module is installed:

Modify the XML-File with your data – this will be loaded on .exe startup:

You can use the source Code. Save the ps1 file and the xml file in the same folder. Run the ps1 File with a user which has access to Active-Dirctory and to ConfigMgr.

For the PS1-File:

<#
    .NOTES
    --------------------------------------------------------------------------------
     Code generated by:  SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.144
     Generated on:       08.10.2017 17:07
     Generated by:       André Vogt @sccmlive
     
    --------------------------------------------------------------------------------
    .DESCRIPTION
        GUI script generated by PowerShell Studio 2017
	Active Directory OU Picker Script can be found on: https://itmicah.wordpress.com/2016/03/29/active-directory-ou-picker-revisited/
#>



#----------------------------------------------
#region Application Functions
#----------------------------------------------

#endregion Application Functions

#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Show-appdeployapplication_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()
	$formKURZDeploymentTool = New-Object 'System.Windows.Forms.Form'
	$textboxstat = New-Object 'System.Windows.Forms.TextBox'
	$trackbar1 = New-Object 'System.Windows.Forms.TrackBar'
	$richtextboxStatus = New-Object 'System.Windows.Forms.RichTextBox'
	$buttonCancel = New-Object 'System.Windows.Forms.Button'
	$buttonBack = New-Object 'System.Windows.Forms.Button'
	$buttonFinish = New-Object 'System.Windows.Forms.Button'
	$tabcontrolWizard = New-Object 'System.Windows.Forms.TabControl'
	$tabpageStep1 = New-Object 'System.Windows.Forms.TabPage'
	$labelOU = New-Object 'System.Windows.Forms.Label'
	$textboxInOU = New-Object 'System.Windows.Forms.TextBox'
	$textboxInstallName = New-Object 'System.Windows.Forms.TextBox'
	$labelName = New-Object 'System.Windows.Forms.Label'
	$ADGroup = New-Object 'System.Windows.Forms.GroupBox'
	$groupbox6 = New-Object 'System.Windows.Forms.GroupBox'
	$labelLanguage = New-Object 'System.Windows.Forms.Label'
	$textboxUninstallName = New-Object 'System.Windows.Forms.TextBox'
	$labelAppName = New-Object 'System.Windows.Forms.Label'
	$textboxUnOU = New-Object 'System.Windows.Forms.TextBox'
	$groupbox5 = New-Object 'System.Windows.Forms.GroupBox'
	$tabpageStep2 = New-Object 'System.Windows.Forms.TabPage'
	$progressbar1 = New-Object 'System.Windows.Forms.ProgressBar'
	$labelDeploymentType = New-Object 'System.Windows.Forms.Label'
	$groupbox2 = New-Object 'System.Windows.Forms.GroupBox'
	$datetimestart = New-Object 'System.Windows.Forms.DateTimePicker'
	$labelDeploymentStarttime = New-Object 'System.Windows.Forms.Label'
	$comboboxdeploytype = New-Object 'System.Windows.Forms.ComboBox'
	$labelApplicationName = New-Object 'System.Windows.Forms.Label'
	$textboxAppName = New-Object 'System.Windows.Forms.TextBox'
	$buttonNext = New-Object 'System.Windows.Forms.Button'
	$openfiledialog1 = New-Object 'System.Windows.Forms.OpenFileDialog'
	$colordialog1 = New-Object 'System.Windows.Forms.ColorDialog'
	$errorprovider1 = New-Object 'System.Windows.Forms.ErrorProvider'
	$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------
	
	#-------------------------------------------------------
	# NOTE: When new TabPage added place the validation code
	# 		in the Test-WizardPage function.
	#-------------------------------------------------------
	
	# Check if the ActiveDirectory module is <finstalled
	$textboxstat.Text = $NULL
	if ((Get-Module -ListAvailable | where { $_.Name -eq 'ActiveDirectory' }) -eq $null)
	{
		$textboxstat.Text = "Install AD-Module"
		$log += $textboxstat.Text
		$richtextboxStatus.BackColor = 'Red'
		
	}
	else
	{
		# Check if the ActiveDirectory module is allready Imported
		If ((Get-Module ActiveDirectory) -eq $null)
		{
			Import-Module ActiveDirectory -ErrorAction 'SilentlyContinue'
			$richtextboxStatus.BackColor = 'Green'
			$textboxstat.Text = "`nAD-Module loaded`n"
			$log += $textboxstat.Text
		
			
		}
		else
		{
			$textboxstat.Text = "AD-Module aleady loaded`n"
			$log += $textboxstat.Text
		}
	}
	$xml = [XML] (Get-Content -Path .\MP.xml)
	$sccm = $xml.MP.Name
	$sitecode = $xml.MP.Code
	$module = $xml.MP.module
        $domainn = $xml.MP.domainname
	
	
	$textboxstat.Text = "`nXML-File used`n"
	$log += $textboxstat.Text
	
	Try
	{
		$sess = New-PSSession -ComputerName $sccm -ConfigurationName Microsoft.PowerShell32 -EA Stop
		$textboxstat.Text = "Remote Session connected`n"
		$log += $textboxstat.Text
	}
	catch
	{
	
		$textboxstat.Text = "Remote Session not loaded"
		$richtextboxStatus.BackColor = 'RED'
		$log += $textboxstat.Text
	}
	
	
	Try
	{
		Invoke-Command -Session $sess -ScriptBlock {
			param(
			$sitecode,
			$module)
			
			Import-module $module
			
			cd $sitecode
			
			gci
		} -ArgumentList $sitecode, $module
	}
	catch
	{
		
		$textboxstat.Text = "Remote Session not loaded"
		$richtextboxStatus.BackColor = 'RED'
		$log += $textboxstat.Text
	}
	
	
	
	#$textboxstat.Text = "Remote Session not loaded"
		#$log += $textboxstat.Text
		#$richtextboxStatus.BackColor = 'RED'
	
	Try
	{
		$apps = Invoke-Command -Session $sess -ScriptBlock {
			(Get-CMApplication -fast).LocalizedDisplayName
		}
	}
	
	catch
	{
		
		$textboxstat.Text = "Remote Session not loaded / rerun with Admin User"
		$richtextboxStatus.BackColor = 'RED'
		$log += $textboxstat.Text
		
		
	}
	
	
	function Test-WizardPage
	{
	<#
		Add TabPages and place the validation code in this function
	#>
		[OutputType([boolean])]
		param([System.Windows.Forms.TabPage]$tabPage)
		
		if($tabPage -eq $tabpageStep1)
		{
			#TODO: Enter Validation Code here for Step 1
			if ($textboxInstallName.Text -and
				$textboxInstallName.ForeColor -ne 'Red' -and
				$textboxInOU.Text -and
				$textboxUninstallName.Text -and
				$textboxUninstallName.ForeColor -ne 'Red' -and
				$textboxUnOU.Text
				)
			{
				return $true
			}
			
			return $false
		}
		elseif ($tabPage -eq $tabpageStep2)
		{
			#TODO: Enter Validation Code here for Step 2
			if ($textboxAppName.Text -and
				$comboboxdeploytype.Text
				)
			{
				return $true
			}
			
			return $false
		}
		
		#Add more pages here
		
		return $false
	}
	
	
	
	$buttonFinish_Click={
		#-------------------------------------------------------
		# TODO: Place finalization script here
		#-------------------------------------------------------
		#create ad groups
		$installdes = "For installation of the application: "
		$installdes_fin = $installdes + $textboxAppName.Text
		$uninstalldes = "For uninstallation of the application: "
		$uninstalldes_fin = $uninstalldes + $textboxAppName.Text
		
		New-ADGroup -DisplayName $textboxInstallName.Text -name $textboxInstallName.Text -Path $textboxInOU.Text -GroupCategory Security -GroupScope Global -Description $installdes_fin
		$progressbar1.Value = 10
		New-ADGroup -DisplayName $textboxUninstallName.Text  -name $textboxUninstallName.Text -Path $textboxUnOU.Text -GroupCategory Security -GroupScope Global -Description $uninstalldes_fin
		$progressbar1.Value = 20
		#create collection
		$sess = New-PSSession -ComputerName $sccm -ConfigurationName Microsoft.PowerShell32
		$progressbar1.Value = 50
		Invoke-Command -Session $sess -ScriptBlock {
			param ($sitecode,
			$module)
			
			Import-module $module
			
			cd $sitecode
			
			gci
		} -ArgumentList $sitecode, $module
		$progressbar1.Value = 78
		try
		{
			Invoke-Command -Session $sess -ScriptBlock {
				param ($textboxInstallName,
					$textboxUninstallName,
					$textboxAppName,
					$comboboxdeploytype,
					$datetimestart,
					$datetimeend,
$domainn)
				
				#COLLECTION SCHEDULE DATE#
				$ScheduleDate = "06/10/2017 9:00 PM"
				$ScheduleDay = "Friday"
				$Schedule1 = New-CMSchedule -Start $ScheduleDate -DayOfWeek $ScheduleDay -RecurCount 1
				$LimitingCollection = 'All Systems'
				New-CMDeviceCollection -Name $textboxInstallName.Text -LimitingCollectionName $LimitingCollection -RefreshSchedule $Schedule1 -RefreshType Both
				New-CMDeviceCollection -Name $textboxUninstallName.Text -LimitingCollectionName $LimitingCollection -RefreshSchedule $Schedule1 -RefreshType Both
				
				#query on collection
				$QueryExp = 'select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.SystemGroupName ='
				$DomainName = $domainn
				$INADGrp = "'" + $DomainName + '\\' + $textboxInstallName.Text + "'"
				$UNADGrp = "'" + $DomainName + '\\' + $textboxUninstallName.Text + "'"
				Add-CMUserCollectionQueryMembershipRule -CollectionName $textboxInstallName.Text -QueryExpression $QueryExp$INADGrp -RuleName $textboxInstallName.Text
				Add-CMUserCollectionQueryMembershipRule -CollectionName $textboxUninstallName.Text -QueryExpression $QueryExp$UNADGrp -RuleName $textboxUninstallName.Text
				$progressbar1.Value = 80
				#start deployment
				if ($comboboxdeloytype.text -eq "Required")
				{
					new-CMApplicationDeployment -Name $textboxAppName.Text -CollectionName $textboxInstallName.Text -DeployPurpose $comboboxdeploytype.Text -Verbose -AvailableDateTime $datetimestart.Text -RebootOutsideServiceWindow $False
				}
				else
				{
					new-CMApplicationDeployment -Name $textboxAppName.Text -CollectionName $textboxInstallName.Text -DeployPurpose $comboboxdeploytype.Text -Verbose -AvailableDateTime $datetimestart.Text -RebootOutsideServiceWindow $False
					
					new-CMApplicationDeployment -Name $textboxAppName.Text -CollectionName $textboxUninstallName.Text -DeployAction Uninstall -Verbose -DeployPurpose Required
				}
				
				
				
			} -ArgumentList $textboxInstallName, $textboxUninstallName, $textboxAppName, $comboboxdeploytype, $datetimestart, $datetimeend,$domainn
		}
		catch
		{ $textboxstat.Text = "Remote Session failed to execute Tasks`n" }
		$progressbar1.Value = 100
		Remove-PSSession $sess
		$textboxstat.Text = "Remote Session disconnected`n"
		$log += $textboxstat.Text
		$log += $textboxstat.Text
		
		#$textboxstat.Text = "Remote Session cannot be disconnected`n"
		#$textboxstat.Text = "Check permissions on Remote-Host`n"
		#$log += $textboxstat.Text
		#$log += $textboxstat.Text
		#$richtextboxStatus.BackColor = 'RED'
		#$log >> log.txt
	}
	
	
	
		
	
	
	
	#region Events and Functions
	$formKURZDeploymentTool_Load={
		Update-NavButtons
	}
	
	function Update-NavButtons
	{
		<# 
			.DESCRIPTION
			Validates the current tab and Updates the Next, Prev and Finish buttons.
		#>
		$enabled = Test-WizardPage $tabcontrolWizard.SelectedTab
		$buttonNext.Enabled = $enabled -and ($tabcontrolWizard.SelectedIndex -lt $tabcontrolWizard.TabCount - 1)
		$buttonBack.Enabled = $tabcontrolWizard.SelectedIndex -gt 0
		$buttonFinish.Enabled = $enabled -and ($tabcontrolWizard.SelectedIndex -eq $tabcontrolWizard.TabCount - 1)	
		#Uncomment to Hide Buttons
		#$buttonNext.Visible = ($tabcontrolWizard.SelectedIndex -lt $tabcontrolWizard.TabCount - 1)
		#$buttonFinish.Visible = ($tabcontrolWizard.SelectedIndex -eq $tabcontrolWizard.TabCount - 1)
	}
	
	$script:DeselectedIndex = -1
	$tabcontrolWizard_Deselecting=[System.Windows.Forms.TabControlCancelEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.TabControlCancelEventArgs]
		# Store the previous tab index
		$script:DeselectedIndex = $_.TabPageIndex
	}
	
	$tabcontrolWizard_Selecting=[System.Windows.Forms.TabControlCancelEventHandler]{
	#Event Argument: $_ = [System.Windows.Forms.TabControlCancelEventArgs]
		# We only validate if we are moving to the Next TabPage. 
		# Users can move back without validating
		if($script:DeselectedIndex -ne -1 -and $script:DeselectedIndex -lt $_.TabPageIndex)
		{
			#Validate each page until we reach the one we want
			for($index = $script:DeselectedIndex; $index -lt $_.TabPageIndex; $index++)
			{
				$_.Cancel = -not (Test-WizardPage $tabcontrolWizard.TabPages[$index])
				
				if($_.Cancel) 
				{
					# Cancel and Return if validation failed.
					return;
				}
			}
		}
		
		Update-NavButtons
	}
	
	$buttonBack_Click={
		#Go to the previous tab page
		if($tabcontrolWizard.SelectedIndex -gt 0)
		{
			$tabcontrolWizard.SelectedIndex--
		}
	}
	
	$buttonNext_Click={	
		#Go to the next tab page
		if($tabcontrolWizard.SelectedIndex -lt $tabcontrolWizard.TabCount - 1)
		{
			$tabcontrolWizard.SelectedIndex++
		}
	}
	
	#endregion
	
	#------------------------------------------------------
	# NOTE: When a Control State changes you should call
	# 		Update-NavButtons to trigger validation
	#------------------------------------------------------
	
	$textboxInstallName_TextChanged = {
		try
		{
			$intest = Get-ADGroup $textboxInstallName.Text
			if ($intest -ne $null)
			{
				$textboxInstallName.Text = "Group-Name already exists"
				$textboxInstallName.ForeColor = "RED"
				$richtextboxStatus.BackColor = 'Red'
				
			}
		}
		catch
		{
			
				Update-NavButtons
				$textboxInstallName.ForeColor = 'Black'
				$richtextboxStatus.BackColor = 'Green'
				
		}
		
		
	}
	
	
	$checkboxCheckToContinue_CheckedChanged={
		Update-NavButtons
	}
	
	$radiobuttonOption_CheckedChanged={
		
		if($this.Checked)
		{
			Update-NavButtons
		}
	}
	
	#region Control Helper Functions
	function Update-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 { Out-Null }
						}
						
						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)	
	}
	
	function Update-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
			Update-ComboBox $combobox1 "Red", "White", "Blue"
		
		.EXAMPLE
			Update-ComboBox $combobox1 "Red" -Append
			Update-ComboBox $combobox1 "White" -Append
			Update-ComboBox $combobox1 "Blue" -Append
		
		.EXAMPLE
			Update-ComboBox $combobox1 (Get-Process) "ProcessName"
		
		.NOTES
			Additional information about the function.
	#>
		
		param
		(
			[Parameter(Mandatory = $true)]
			[ValidateNotNull()]
			[System.Windows.Forms.ComboBox]
			$ComboBox,
			[Parameter(Mandatory = $true)]
			[ValidateNotNull()]
			$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
	}
	#endregion
	
	$openfiledialog1_FileOk=[System.ComponentModel.CancelEventHandler]{
	#Event Argument: $_ = [System.ComponentModel.CancelEventArgs]
		#TODO: Place custom script here
		
	}
	
	
	
	$textboxUninstallName_TextChanged={
		#TODO: Place custom script here
		try
		{
			$unintest = Get-ADGroup $textboxUninstallName.Text
			if ($unintest -ne $null)
			{
				$textboxUninstallName.Text = "Group-Name already exists"
				$textboxUninstallName.ForeColor = "RED"
				$richtextboxStatus.BackColor = 'Red'
				
			}
		}
		catch
		{
			
			Update-NavButtons
			$textboxUninstallName.ForeColor = 'Black'
			$richtextboxStatus.BackColor = 'Green'
			
		}
		
		
	}
	
	$textboxUnOU_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
		
	}
	
	$textboxarchi_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxSPath_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxDPath_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxType_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxFile_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxParameter_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxUntype_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxName_Para_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxUNamePara_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxUType_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxSourceOUSCCM_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxDestination_DP_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxADGROUP_Name_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxAD_OU_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxinOu_enter = {
		#TODO: Place custom script here
		
		$textboxInOU.Text= (Choose-ADOrganizationalUnit).DistinguishedName
	}
	
	$textboxunOu_enter = {
		#TODO: Place custom script here
		$textboxUnOU.Text = (Choose-ADOrganizationalUnit).DistinguishedName
		
	}
	
	$textboxinOU_TextChanged = {
		#TODO: Place custom script here
		
		Update-NavButtons
		
	}
	
	
	
	
	$textboxappName_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$textboxAppName_Enter={
		#TODO: Place custom script here
		
		$app = $apps | Sort-Object | Out-GridView -PassThru -Title 'Select the Application you want to Deploy to the Collection'
		$textboxAppName.Text = $app
		
	}
	
	
	function Choose-ADOrganizationalUnit
	{
		[CmdletBinding()]
		Param
		(
			#FQDN or Distinguished Name of the domain you want to view
			[Parameter(ValueFromPipelineByPropertyName = $true,
					   Position = 0)]
			[Alias("DistinguishedName")]
			[string]$Domain,
			#Credentials for connecting to ActiveDirectory domain
	
			[Parameter(Mandatory = $false,
					   Position = 1)]
			$Credential,
			#Enable Advanced features on startup
	
			[switch]$AdvancedFeatures,
			#Hide the ability to create OU's
	
			[switch]$HideNewOUFeature,
			#Add checkboxes so multiple objects can be selected
	
			[switch]$MultiSelect
		)
		
		
		#region Import the Assemblies
		
		[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
		[void][reflection.assembly]::Load("System.Windows.Forms, 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, 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")
		[void][reflection.assembly]::Load("System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
		[void][reflection.assembly]::Load("System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
		#endregion Import Assemblies
		
		
		#region Form Objects
		
		[System.Windows.Forms.Application]::EnableVisualStyles()
		$formChooseOU = New-Object 'System.Windows.Forms.Form'
		$cb_AdvancedFeatures = New-Object 'System.Windows.Forms.CheckBox'
		$Treeview = New-Object 'System.Windows.Forms.TreeView'
		$buttonOK = New-Object 'System.Windows.Forms.Button'
		$imagelist = New-Object 'System.Windows.Forms.ImageList'
		$ContextMenu = New-Object 'System.Windows.Forms.ContextMenuStrip'
		$changeDomainToolStripMenuItem = New-Object 'System.Windows.Forms.ToolStripMenuItem'
		$newOUToolStripMenuItem = New-Object 'System.Windows.Forms.ToolStripMenuItem'
		$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
		#endregion Form Objects
		
		#region Functions
		
		function Show-Error
		{
			Param ([string]$Message)
			
			$msgbox = [System.Windows.Forms.MessageBox]::Show($Message, "Exception Report", 0, 16)
		}
		
		function Test-LDAPConnection
		{
			Param (
				$ComputerName
			)
			$TCPClient = New-Object Net.Sockets.TcpClient
			$TCPClient.Connect($ComputerName, 389)
			$TestOutput = [pscustomobject]@{
				ComputerName   = $ComputerName
				Connected	   = $TCPClient.Connected
				IPAddress	   = ''
			}
			If ($TCPClient.Connected)
			{
				$TestOutput.IPAddress = $TCPClient.Client.RemoteEndPoint.Address.IPAddressToString
			}
			$TCPClient.Close()
			$TestOutput
		}
		
		function Add-Node
		{
			param (
				$RootNode,
				$dname,
				$name,
				$Type,
				$HasChildren = $true
			)
			
			$newNode = new-object System.Windows.Forms.TreeNode
			$newNode.Name = $dname
			$newNode.Text = $name
			If ($HasChildren)
			{
				$newNode.Nodes.Add('') | Out-Null
			}
			switch ($Type)
			{
				organizationalunit	{
					$newnode.ImageIndex = 3
					$newNode.SelectedImageIndex = 3
				}
				Domain 				{
					$newNode.ImageIndex = 2
					$newNode.SelectedImageIndex = 2
				}
				Default
				{
					$newnode.ImageIndex = 0
					$newNode.SelectedImageIndex = 0
				}
			}
			$RootNode.Nodes.Add($newNode) | Out-Null
			$newNode
		}
		
		function Get-NextLevel
		{
			param (
				$RootNode,
				$Type
			)
			
			If ($Type -eq 'Domain')
			{
				$ADObjects = $forest.domains | ?{ $_.Name -eq $RootNode.Text } |
				select -ExpandProperty Children
				$RootNode.Nodes.Clear()
				$ADObjects | % {
					$node = Add-Node -RootNode $RootNode -dname $_.GetDirectoryEntry().distinguishedName -name $_.name -Type $Type
					Get-NextLevel -RootNode $node -Type $Type
				}
			}
			else
			{
				If ($DomainIP)
				{
					If ($Credential)
					{
						$ADsearcher.SearchRoot = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$DomainIP/$($RootNode.Name)", $Credential.UserName, $Credential.GetNetworkCredential().password)
					}
					else
					{
						$ADsearcher.SearchRoot = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$DomainIP/$($RootNode.Name)")
					}
				}
				elseif ($Credential)
				{
					$ADsearcher.SearchRoot = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$($RootNode.Name)", $Credential.UserName, $Credential.GetNetworkCredential().password)
				}
				else
				{
					$ADsearcher.SearchRoot = "LDAP://$($RootNode.Name)"
				}
				$ADsearcher.filter = "(|(objectClass=organizationalUnit)(ObjectClass=container)(ObjectClass=builtinDomain))"
				$ADsearcher.SearchScope = 'OneLevel'
				
				IF ($cb_AdvancedFeatures.Checked)
				{
					$ADObjects = $ADsearcher.FindAll()
				}
				else
				{
					$ADObjects = $ADsearcher.FindAll() | ?{
						$_.Properties['showinadvancedviewonly'][0] -eq $false -or
						$_.Properties['showinadvancedviewonly'][0] -eq $null
					}
				}
				
				If ($ADObjects)
				{
					$RootNode.Nodes.Clear()
					$ADObjects | % {
						$Type = $_.properties.objectclass | ?{ $_ -ne 'top' }
						If ($Credential)
						{
							$ADsearcher.SearchRoot = New-Object System.DirectoryServices.DirectoryEntry($_.Path, $Credential.UserName, $Credential.GetNetworkCredential().password)
						}
						else
						{
							$ADsearcher.SearchRoot = $_.Path
						}
						If ($ADsearcher.FindOne())
						{
							Add-Node $RootNode $_.properties.distinguishedname[0] $_.properties.name[0] -Type $Type -HasChildren $true
						}
						else
						{
							Add-Node $RootNode $_.properties.distinguishedname[0] $_.properties.name[0] -Type $Type -HasChildren $false
						}
					}
				}
			}
		}
		
		function Build-TreeView
		{
			$treeNodes = $Treeview.Nodes[0]
			
			#Generate rootdomain node and add subdomain nodes
			If ($DomainDN)
			{
				$DomainName = $DomainDN.Replace(',DC=', '.').Substring(3)
				$RootDomainNode = Add-Node -dname $DomainDN `
										   -name $DomainName -RootNode $treeNodes -Type Domain
			}
			else
			{
				$CurrentDomain = $Forest.Domains | ?{ $_.Name -eq $env:USERDNSDOMAIN }
				$Domain = $CurrentDomain.GetDirectoryEntry()
				$RootDomainNode = Add-Node -dname $Domain.distinguishedName `
										   -name $CurrentDomain.Name -RootNode $treeNodes -Type Domain
			}
			#Copy the RootDomainNode to parent scope
			New-Variable -Name RootDomainNode -Value $RootDomainNode -Scope 1
			
			$treeNodes.Expand()
			$RootDomainNode.Expand()
		}
		
		function Change-Domain
		{
			#region Form Objects
			
			$formBrowseForDomain = New-Object 'System.Windows.Forms.Form'
			$labelDomains = New-Object 'System.Windows.Forms.Label'
			$TreeviewForest = New-Object 'System.Windows.Forms.TreeView'
			$buttonCancelDomain = New-Object 'System.Windows.Forms.Button'
			$buttonOKDomain = New-Object 'System.Windows.Forms.Button'
			$buttonChangeForest = New-Object 'System.Windows.Forms.Button'
			$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
			
			#endregion Form Objects
			
			#region Events
			
			$FormEvent_Shown = {
				#Create domains treeview
				$DName = $forest.RootDomain.GetDirectoryEntry().distinguishedName
				$NodeProps = @{
					dname   = $Dname
					name    = $forest.RootDomain.Name
					RootNode = $TreeviewForest
					Type    = 'Domain'
				}
				$RootDomainNode = Add-Node @NodeProps
				Get-NextLevel -RootNode $RootDomainNode -Type Domain
				$TreeviewForest.ExpandAll()
			}
			
			$Form_StateCorrection_Load =
			{
				#Correct the initial state of the form to prevent the .Net maximized form issue
				$formBrowseForDomain.WindowState = $InitialFormWindowState
			}
			
			$Form_Cleanup_FormClosed =
			{
				#Remove all event handlers from the controls
				try
				{
					$formBrowseForDomain.remove_Load($FormEvent_Load)
					$formBrowseForDomain.remove_Load($Form_StateCorrection_Load)
					$formBrowseForDomain.remove_FormClosed($Form_Cleanup_FormClosed)
					$TreeviewForest.remove_DoubleClick($TreeviewForest_DoubleClick)
				}
				catch [Exception]
				{ }
			}
			
			$TreeviewForest_DoubleClick = {
				#Click OK Button
				If ($TreeviewForest.SelectedNode.Nodes.Count -eq 0)
				{
					$buttonOKDomain.PerformClick()
				}
			}
			
			$buttonChangeForest_Click = {
				$Refresh = $false
				New-Variable -Name ChangeForest -Value (Change-Forest) -Scope 1 -Force
				If ($ChangeForest.Forest)
				{
					$forest = $ChangeForest.Forest
					$Refresh = $true
				}
				If ($ChangeForest.Credential)
				{
					$Credential = $ChangeForest.Credential
					$Refresh = $true
				}
				If ($Refresh)
				{
					$TreeviewForest.Nodes.Clear()
					$TreeviewForest.Refresh()
					& $FormEvent_Shown
				}
			}
			
			#endregion Events
			
			#region Form Code
			
			#
			# formBrowseForDomain
			#
			$formBrowseForDomain.Controls.Add($labelDomains)
			$formBrowseForDomain.Controls.Add($TreeviewForest)
			$formBrowseForDomain.Controls.Add($buttonCancelDomain)
			$formBrowseForDomain.Controls.Add($buttonOKDomain)
			$formBrowseForDomain.Controls.Add($buttonChangeForest)
			$formBrowseForDomain.AcceptButton = $buttonOKDomain
			$formBrowseForDomain.CancelButton = $buttonCancelDomain
			$formBrowseForDomain.ClientSize = '284, 279'
			$formBrowseForDomain.FormBorderStyle = 'FixedDialog'
			$formBrowseForDomain.MaximizeBox = $False
			$formBrowseForDomain.MinimizeBox = $False
			$formBrowseForDomain.Name = "formBrowseForDomain"
			$formBrowseForDomain.StartPosition = 'CenterScreen'
			$formBrowseForDomain.Text = "Browse for Domain"
			$formBrowseForDomain.add_Shown($FormEvent_Shown)
			#
			# labelDomains
			#
			$labelDomains.Location = '12, 9'
			$labelDomains.Name = "labelDomains"
			$labelDomains.Size = '99, 16'
			$labelDomains.TabIndex = 2
			$labelDomains.Text = "Domains:"
			#
			# TreeviewForest
			#
			$TreeviewForest.Location = '12, 28'
			$TreeviewForest.ImageList = $imagelist
			$TreeviewForest.ImageIndex = 2
			$TreeviewForest.Name = "TreeviewForest"
			$TreeviewForest.Size = '260, 193'
			$TreeviewForest.TabIndex = 1
			$TreeviewForest.add_DoubleClick($TreeviewForest_DoubleClick)
			#
			# buttonCancelDomain
			#
			$buttonCancelDomain.Anchor = 'Bottom, Right'
			$buttonCancelDomain.DialogResult = 'Cancel'
			$buttonCancelDomain.Location = '197, 244'
			$buttonCancelDomain.Name = "buttonCancelDomain"
			$buttonCancelDomain.Size = '75, 23'
			$buttonCancelDomain.TabIndex = 0
			$buttonCancelDomain.Text = "Can&cel"
			$buttonCancelDomain.UseVisualStyleBackColor = $True
			#
			# buttonOKDomain
			#
			$buttonOKDomain.Anchor = 'Bottom, Right'
			$buttonOKDomain.DialogResult = 'OK'
			$buttonOKDomain.Location = '116, 244'
			$buttonOKDomain.Name = "buttonOKDomain"
			$buttonOKDomain.Size = '75, 23'
			$buttonOKDomain.TabIndex = 0
			$buttonOKDomain.Text = "&OK"
			$buttonOKDomain.UseVisualStyleBackColor = $True
			#
			# buttonChangeForest
			#
			$buttonChangeForest.Anchor = 'Bottom, Left'
			#$buttonChangeForest.DialogResult = 'OK'
			$buttonChangeForest.Location = '13, 244'
			$buttonChangeForest.Name = "buttonChangeForest"
			$buttonChangeForest.Size = '91, 23'
			$buttonChangeForest.TabIndex = 0
			$buttonChangeForest.Text = "Change &Forest"
			$buttonChangeForest.UseVisualStyleBackColor = $True
			$buttonChangeForest.add_Click($buttonChangeForest_Click)
			#endregion Form Code
			
			#Save the initial state of the form
			$InitialFormWindowState = $formBrowseForDomain.WindowState
			#Init the OnLoad event to correct the initial state of the form
			$formBrowseForDomain.add_Load($Form_StateCorrection_Load)
			#Clean up the control events
			$formBrowseForDomain.add_FormClosed($Form_Cleanup_FormClosed)
			#Show the Form
			IF ($formBrowseForDomain.ShowDialog() -eq 'OK')
			{
				If ($ChangeForest)
				{
					$Props = @{
						MemberType   = 'NoteProperty'
						Name		 = 'NewDomainDN'
						Value	     = $TreeviewForest.SelectedNode.Name
					}
					$ChangeForest | Add-Member @Props -PassThru
				}
				else
				{
					[pscustomobject]@{
						NewDomainDN   = $TreeviewForest.SelectedNode.Name
					}
				}
			}
		}
		
		function Change-Forest
		{
			[System.Windows.Forms.Application]::EnableVisualStyles()
			$formChangeForest = New-Object 'System.Windows.Forms.Form'
			$CB_UseCred = New-Object 'System.Windows.Forms.CheckBox'
			$GB_Creds = New-Object 'System.Windows.Forms.GroupBox'
			$MTB_Password = New-Object 'System.Windows.Forms.MaskedTextBox'
			$TB_UserName = New-Object 'System.Windows.Forms.TextBox'
			$labelUsernamePassword = New-Object 'System.Windows.Forms.Label'
			$tb_DCName = New-Object 'System.Windows.Forms.TextBox'
			$labelDomainControllerFQDN = New-Object 'System.Windows.Forms.Label'
			$buttonOK = New-Object 'System.Windows.Forms.Button'
			$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
			
			$CB_UseCred_CheckedChanged = {
				$GB_Creds.Enabled = $CB_UseCred.Checked
			}
			
			$buttonOK_Click = {
				$formChangeForest.Cursor = 'WaitCursor'
				$ServerName = $tb_DCName.Text
				$UserName = $TB_UserName.Text
				$Password = $MTB_Password.Text
				try
				{
					$LDAPTest = Test-LDAPConnection -ComputerName $ServerName
					If ($LDAPTest.Connected)
					{
						Write-Verbose "Connection successful."
					}
					else
					{
						throw "Unable to connect to server '$ServerName' on LDAP port 389."
					}
					If ($CB_UseCred.Checked)
					{
						$DomainEntry = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$ServerName", $UserName, $Password)
						$SecPwd = $Password | ConvertTo-SecureString -AsPlainText -Force
						$ForestCred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $SecPwd
					}
					else
					{
						$DomainEntry = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$ServerName")
					}
					If ($DomainEntry.Name -eq $null)
					{
						throw "Unable to connect to server '$ServerName'"
					}
					$DomainContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext("Domain", $DomainEntry.name)
					$Domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetDomain($DomainContext)
					$ForestContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext("Forest", $domain.forest)
					$RemoteForest = [System.DirectoryServices.ActiveDirectory.Forest]::GetForest($ForestContext)
					$Props = @{
						Server   = $LDAPTest.IPAddress
					}
					If ($RemoteForest)
					{
						$Props.Add('Forest', $RemoteForest)
					}
					If ($ForestCred)
					{
						$Props.Add('Credential', $ForestCred)
					}
					New-Variable -Name ForestOutput -Scope 1 -Value ([pscustomobject]$Props)
				}
				catch
				{
					$Message = 'Connection failed! ' + $_.exception.message
					$ErrorMsg = [System.Windows.Forms.MessageBox]::Show($Message, "Connection failure", 0, 16)
				}
				$formChangeForest.Cursor = 'Default'
			}
			
			$Form_StateCorrection_Load = {
				#Correct the initial state of the form to prevent the .Net maximized form issue
				$formChangeForest.WindowState = $InitialFormWindowState
			}
			
			$Form_Cleanup_FormClosed = {
				#Remove all event handlers from the controls
				try
				{
					$CB_UseCred.remove_CheckedChanged($CB_UseCred_CheckedChanged)
					$buttonOK.remove_Click($buttonOK_Click)
					$formChangeForest.remove_Load($Form_StateCorrection_Load)
					$formChangeForest.remove_FormClosed($Form_Cleanup_FormClosed)
				}
				catch [Exception]
				{ }
			}
			
			# formChangeForest
			#
			$formChangeForest.Controls.Add($CB_UseCred)
			$formChangeForest.Controls.Add($GB_Creds)
			$formChangeForest.Controls.Add($tb_DCName)
			$formChangeForest.Controls.Add($labelDomainControllerFQDN)
			$formChangeForest.Controls.Add($buttonOK)
			$formChangeForest.AcceptButton = $buttonOK
			$formChangeForest.ClientSize = '253, 222'
			$formChangeForest.FormBorderStyle = 'FixedDialog'
			$formChangeForest.MaximizeBox = $False
			$formChangeForest.MinimizeBox = $False
			$formChangeForest.Name = "formChangeForest"
			$formChangeForest.StartPosition = 'CenterScreen'
			$formChangeForest.Text = "Change Forest"
			#
			# CB_UseCred
			#
			$CB_UseCred.Anchor = 'Bottom, Left'
			$CB_UseCred.Location = '13, 68'
			$CB_UseCred.Name = "CB_UseCred"
			$CB_UseCred.Size = '172, 24'
			$CB_UseCred.TabIndex = 3
			$CB_UseCred.Text = "Use alternate credentials"
			$CB_UseCred.UseVisualStyleBackColor = $True
			$CB_UseCred.add_CheckedChanged($CB_UseCred_CheckedChanged)
			#
			# GB_Creds
			#
			$GB_Creds.Controls.Add($MTB_Password)
			$GB_Creds.Controls.Add($TB_UserName)
			$GB_Creds.Controls.Add($labelUsernamePassword)
			$GB_Creds.Anchor = 'Left, Right'
			$GB_Creds.Enabled = $False
			$GB_Creds.Location = '13, 98'
			$GB_Creds.Name = "GB_Creds"
			$GB_Creds.Size = '227, 83'
			$GB_Creds.TabIndex = 4
			$GB_Creds.TabStop = $False
			$GB_Creds.Text = "Alternate credentials"
			#
			# MTB_Password
			#
			$MTB_Password.Location = '85, 47'
			$MTB_Password.Name = "MTB_Password"
			$MTB_Password.PasswordChar = '*'
			$MTB_Password.Size = '127, 20'
			$MTB_Password.TabIndex = 5
			#
			# TB_UserName
			#
			$TB_UserName.Location = '85, 20'
			$TB_UserName.Name = "TB_UserName"
			$TB_UserName.Size = '127, 20'
			$TB_UserName.TabIndex = 4
			#
			# labelUsernamePassword
			#
			$labelUsernamePassword.Location = '7, 20'
			$labelUsernamePassword.Name = "labelUsernamePassword"
			$labelUsernamePassword.Size = '71, 52'
			$labelUsernamePassword.TabIndex = 0
			$labelUsernamePassword.Text = "Username

Password"
			#
			# tb_DCName
			#
			$tb_DCName.Location = '13, 37'
			$tb_DCName.Name = "tb_DCName"
			$tb_DCName.Size = '227, 20'
			$tb_DCName.TabIndex = 2
			#
			# labelDomainControllerFQDN
			#
			$labelDomainControllerFQDN.Location = '13, 13'
			$labelDomainControllerFQDN.Name = "labelDomainControllerFQDN"
			$labelDomainControllerFQDN.Size = '227, 16'
			$labelDomainControllerFQDN.TabIndex = 1
			$labelDomainControllerFQDN.Text = "Domain Controller (FQDN or IP address):"
			#
			# buttonOK
			#
			$buttonOK.Anchor = 'Bottom, Right'
			$buttonOK.DialogResult = 'OK'
			$buttonOK.Location = '166, 187'
			$buttonOK.Name = "buttonOK"
			$buttonOK.Size = '75, 23'
			$buttonOK.TabIndex = 6
			$buttonOK.Text = "&OK"
			$buttonOK.UseVisualStyleBackColor = $True
			$buttonOK.add_Click($buttonOK_Click)
			
			#Save the initial state of the form
			$InitialFormWindowState = $formChangeForest.WindowState
			#Init the OnLoad event to correct the initial state of the form
			$formChangeForest.add_Load($Form_StateCorrection_Load)
			#Clean up the control events
			$formChangeForest.add_FormClosed($Form_Cleanup_FormClosed)
			#Show the Form
			If ($formChangeForest.ShowDialog() -eq 'OK')
			{
				$ForestOutput
			}
		}
		
		#endregion Functions
		
		#region Script
		
		$FormEvent_Load = {
			
			If ((gwmi win32_computersystem).partofdomain)
			{
				$forest = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
				#Validate Domain variable if present
				If ($Domain)
				{
					If ($Domain -match 'CN=|OU=')
					{
						throw "'$Domain' is not a domain distinguished name."
						$formChooseOU.Close()
					}
					ElseIf ($Domain -match '\w+\.\w+')
					{
						If ($forest.Domains.Name -contains $Domain)
						{
							$DomainDN = "DC=$($Domain.ToUpper())" -replace '\.', ',DC='
						}
						else
						{
							throw "No domain found with FQDN '$Domain'."
							$formChooseOU.Close()
						}
					}
					ElseIf ($Domain -match 'DC=\w+,DC+')
					{
						If ([adsi]::exists("LDAP://$Domain"))
						{
							$DomainDN = $Domain
						}
						else
						{
							throw "'$Domain' does not exist in Active Directory."
							$formChooseOU.Close()
						}
					}
					New-Variable -Name DomainDN -Value $DomainDN -Scope 1
				}
				If ($Credential)
				{
					$Credential = Get-Credential $Credential -Message "Please enter credentials to connect to domain '$Domain'"
					try
					{
						$root = New-Object -TypeName System.DirectoryServices.DirectoryEntry("LDAP://$DomainDN", $Credential.UserName, $Credential.GetNetworkCredential().password)
					}
					catch
					{
						Show-Error "Unable to connect to domain '$Domain'."
						$host.SetShouldExit(1)
						return
					}
				}
				else
				{
					$root = [ADSI]''
				}
				$ADSearcher = New-Object System.DirectoryServices.DirectorySearcher($root)
				New-Variable -Name ADSearcher -Value $ADSearcher -Scope 1
				New-Variable -Name Forest -Value $forest -Scope 1
			}
			elseif ($Domain)
			{
				If ($Domain -match 'CN=|OU=')
				{
					throw "'$Domain' is not a domain distinguished name."
					$formChooseOU.Close()
				}
				If ($Domain -match '\w+\.\w+')
				{
					$DomainDN = "DC=$($Domain.ToUpper())" -replace '\.', ',DC='
				}
				ElseIf ($Domain -match 'DC=\w+,DC+')
				{
					$DomainDN = $Domain
					$Domain = $Domain.Replace('DC=', '.').TrimStart('DC=')
				}
				New-Variable -Name DomainDN -Value $DomainDN -Scope 1
				$Credential = Get-Credential $Credential -Message "Please enter credentials to connect to domain '$Domain'"
				try
				{
					$LDAPTest = Test-LDAPConnection -ComputerName $Domain
					If ($LDAPTest.Connected)
					{
						Write-Verbose "Connection successful."
					}
					else
					{
						throw "Unable to connect to '$Domain' on LDAP port 389."
					}
					$DomainIP = $LDAPTest.IPAddress
					$root = New-Object -TypeName System.DirectoryServices.DirectoryEntry("LDAP://$DomainIP", $Credential.UserName, $Credential.GetNetworkCredential().password)
					New-Variable -Name DomainIP -Value $DomainIP -Scope 1
				}
				catch
				{
					Show-Error "Unable to connect to domain '$Domain'."
					$host.SetShouldExit(1)
					return
				}
				$ADSearcher = new-object System.DirectoryServices.DirectorySearcher($root)
				New-Variable -Name ADSearcher -Value $ADSearcher -Scope 1
			}
			else
			{
				$Domain = Read-Host 'Please enter a domain to connect to'
				If ($Domain)
				{
					& $FormEvent_Load
				}
				else
				{
					return
				}
			}
			If ($Credential)
			{
				Set-Variable -Name Credential -Value $Credential -Scope 1 -Force
			}
			If ($MultiSelect)
			{
				$Treeview.CheckBoxes = $true
			}
			$cb_AdvancedFeatures.Checked = $AdvancedFeatures
			$ADSearcher.PropertiesToLoad.AddRange(@('name', 'distinguishedname'))
		}
		
		$CreateOU = [System.Windows.Forms.NodeLabelEditEventHandler]{
			#Event Argument: $_ = [System.Windows.Forms.NodeLabelEditEventArgs]
			$NewNode = $_.Node
			$Label = $_.Label
			$NewNode.Name = "OU=$Label,$($NewNode.Parent.Name)"
			$objParent = [ADSI]"LDAP://$($NewNode.Parent.Name)"
			$objOU = $objParent.Create("organizationalUnit", "ou=$Label")
			try
			{
				Write-Verbose "Creating OU '$($_.Label)'."
				$objOU.SetInfo()
				
				Write-Verbose "Setting 'protect from accidental deletion'."
				$ObjectSecurity = $objOU.psbase.ObjectSecurity
				$EveryOne = New-Object -TypeName System.Security.Principal.NTAccount -ArgumentList '', 'Everyone'
				$Act = [System.Security.AccessControl.AccessControlType]::Deny
				$ADRights = [System.DirectoryServices.ActiveDirectoryRights]::Delete
				$NewRule = New-Object -TypeName System.DirectoryServices.ActiveDirectoryAccessRule -ArgumentList $EveryOne, $ADRights, $Act
				$ObjectSecurity.AddAccessRule($NewRule)
				$ADRights = [System.DirectoryServices.ActiveDirectoryRights]::DeleteTree
				$NewRule = New-Object -TypeName System.DirectoryServices.ActiveDirectoryAccessRule -ArgumentList $EveryOne, $ADRights, $Act
				$ObjectSecurity.AddAccessRule($NewRule)
				$objOU.psbase.CommitChanges()
			}
			catch [System.UnauthorizedAccessException]
			{
				$TryWithCred = $true
			}
			catch
			{
				$Treeview.SelectedNode = $NewNode.Parent
				$Treeview.Nodes.Remove($NewNode)
				Show-Error -Message $_.Exception.GetBaseException().Message
			}
			If ($TryWithCred)
			{
				try
				{
					If (!$ADWriteCred)
					{
						$Cred = $host.ui.PromptForCredential("Insufficient rights in AD detected", "Please enter credentials with sufficient rights in Active Directory.", "", "NetBiosUserName")
						
						If ($Cred)
						{
							#Create variable in parent scope
							New-Variable -Name ADWriteCred -Value $Cred -Scope 1
						}
						else
						{
							$Treeview.SelectedNode = $NewNode.Parent
							$Treeview.Nodes.Remove($NewNode)
							return
						}
					}
					$DomainDN = ($NewNode.Name.Split(',') | ?{ $_ -like 'DC=*' }) -Join ','
					$objParent = New-Object System.DirectoryServices.DirectoryEntry "LDAP://$($NewNode.Parent.Name)", $($ADWriteCred.UserName), $($ADWriteCred.GetNetworkCredential().password)
					$objOU = $objParent.Create("organizationalUnit", "ou=$Label")
					
					Write-Verbose "Creating OU '$Label'."
					$objOU.SetInfo()
					Write-Verbose "Setting 'protect from accidental deletion'."
					$ObjectSecurity = $objOU.psbase.ObjectSecurity
					$EveryOne = New-Object -TypeName System.Security.Principal.NTAccount -ArgumentList '', 'Everyone'
					$Act = [System.Security.AccessControl.AccessControlType]::Deny
					$ADRights = [System.DirectoryServices.ActiveDirectoryRights]::Delete
					$NewRule = New-Object -TypeName System.DirectoryServices.ActiveDirectoryAccessRule -ArgumentList $EveryOne, $ADRights, $Act
					$ObjectSecurity.AddAccessRule($NewRule)
					$ADRights = [System.DirectoryServices.ActiveDirectoryRights]::DeleteTree
					$NewRule = New-Object -TypeName System.DirectoryServices.ActiveDirectoryAccessRule -ArgumentList $EveryOne, $ADRights, $Act
					$ObjectSecurity.AddAccessRule($NewRule)
					$ADRights = [System.DirectoryServices.ActiveDirectoryRights]::DeleteChild
					$NewRule = New-Object -TypeName System.DirectoryServices.ActiveDirectoryAccessRule -ArgumentList $EveryOne, $ADRights, $Act
					$ObjectSecurity.AddAccessRule($NewRule)
					$objOU.psbase.CommitChanges()
				}
				catch
				{
					$Treeview.SelectedNode = $NewNode.Parent
					$Treeview.Nodes.Remove($NewNode)
					$Text = $_.Exception.Message
					Show-Error -Message $_.Exception.GetBaseException().Message
				}
			}
			$Treeview.LabelEdit = $false
		}
		
		$buttonOK_Click = {
			If ($Treeview.SelectedNode -and !$MultiSelect)
			{
				New-Variable -Scope 1 -Name SelectedObject -Value ([pscustomobject]@{
						Name   = $Treeview.SelectedNode.Text
						DistinguishedName = $Treeview.SelectedNode.Name
					})
			}
		}
		
		$formChooseOU_Shown = {
			#Build treeview when form is shown
			$formChooseOU.Cursor = 'WaitCursor'
			try
			{
				Build-TreeView
			}
			catch
			{
				Show-Error ($_ | Out-String)
			}
			finally
			{
				$formChooseOU.Cursor = 'Default'
			}
		}
		
		$Treeview_BeforeExpand = [System.Windows.Forms.TreeViewCancelEventHandler]{
			#Get next level for current node
			If ($_.Node.Level -ne 0)
			{
				Get-NextLevel -RootNode $_.Node
			}
		}
		
		$cb_AdvancedFeatures_CheckedChanged = {
			#Refresh the treeview
			If ($Treeview.Nodes[0].Nodes)
			{
				$Treeview.Nodes[0].Nodes.Clear()
				& $formChooseOU_Shown
			}
		}
		
		$Treeview_DoubleClick = {
			#Click OK Button
			If ($Treeview.SelectedNode.Nodes.Count -eq 0)
			{
				$buttonOK.PerformClick()
				New-Variable -Scope 1 -Name SelectedObject -Value $SelectedObject
			}
		}
		
		$changeDomainToolStripMenuItem_Click = {
			#call Change Domain form
			$Refresh = $false
			$ChangeDomain = Change-Domain
			If ($ChangeDomain.NewDomainDN)
			{
				New-Variable -Name DomainDN -Value $ChangeDomain.NewDomainDN -Scope 1 -Force
				$Refresh = $true
			}
			else
			{
				return
			}
			If ($ChangeDomain.Forest)
			{
				Set-Variable -Name Forest -Value $ChangeDomain.forest -Scope 1 -Force
				New-Variable -Name DomainIP -Value $ChangeDomain.server -Scope 1 -Force
				$Refresh = $true
			}
			If ($ChangeDomain.Credential)
			{
				Set-Variable -Name Credential -Value $ChangeDomain.Credential -Scope 1 -Force
				$Refresh = $true
			}
			If ($Refresh)
			{
				$Treeview.Nodes[0].Nodes.Clear()
				$Treeview.Refresh()
				Build-TreeView
			}
		}
		
		$newOUToolStripMenuItem_Click = {
			#Create new node and edit the label
			$SelectedObject = $Treeview.SelectedNode
			If (!$SelectedObject.IsExpanded)
			{
				$SelectedObject.Expand()
			}
			$newOuNode = new-object System.Windows.Forms.TreeNode
			$newOuNode.text = "New OU"
			$newOuNode.Name = "New OU Name"
			$newOuNode.ImageIndex = 3
			$newOuNode.SelectedImageIndex = 3
			$SelectedObject.Nodes.Add($newOuNode) | Out-Null
			$Treeview.SelectedNode = $NewOUNode
			$Treeview.LabelEdit = $true
			$newOuNode.BeginEdit()
		}
		
		$Treeview_NodeMouseClick = [System.Windows.Forms.TreeNodeMouseClickEventHandler]{
			#Event Argument: $_ = [System.Windows.Forms.TreeNodeMouseClickEventArgs]
			if ($_.Button -eq 'Right')
			{
				$Treeview.SelectedNode = $_.Node
				if ($_.Node.ImageIndex -eq 0)
				{
					return
				}
				$ContextMenu.Items.Clear()
				if ($_.Node.ImageIndex -lt 3 -and (gwmi win32_computersystem).partofdomain)
				{
					$ContextMenu.Items.Add($changeDomainToolStripMenuItem)
				}
				if ($_.Node.ImageIndex -gt 1 -and !$HideNewOUFeature)
				{
					$ContextMenu.Items.Add($newOUToolStripMenuItem)
				}
				If ($ContextMenu.Items.Count -gt 0)
				{
					$ContextMenu.Show($Treeview, $_.Location)
				}
			}
		}
		
		$Treeview_BeforeCheck = [System.Windows.Forms.TreeViewCancelEventHandler]{
			#Event Argument: $_ = [System.Windows.Forms.TreeViewCancelEventArgs]
			#Prevent checking root node
			if ($_.Node.ImageIndex -eq 1)
			{
				$_.Cancel = $true
			}
		}
		
		$Treeview_AfterCheck = [System.Windows.Forms.TreeViewEventHandler]{
			#Event Argument: $_ = [System.Windows.Forms.TreeViewEventArgs]
			If (!$SelectedObject)
			{
				New-Variable -Name SelectedObject -Scope 1 -Value (New-Object collections.arraylist)
			}
			If ($_.Node.Checked)
			{
				$SelectedObject.Add([pscustomobject]@{
						Name   = $_.Node.Text
						DistinguishedName = $_.Node.Name
					})
			}
			else
			{
				$DN = $_.Node.Name
				$SelectedObject | %{
					If ($_.DistinguishedName -eq $DN)
					{
						$Remove = $_
					}
				}
				$SelectedObject.Remove($Remove)
			}
		}
		
		#endregion Script
		
		#region Events
		
		$Form_StateCorrection_Load =
		{
			#Correct the initial state of the form to prevent the .Net maximized form issue
			$formChooseOU.WindowState = $InitialFormWindowState
		}
		
		$Form_Cleanup_FormClosed =
		{
			#Remove all event handlers from the controls
			try
			{
				$cb_AdvancedFeatures.remove_CheckedChanged($cb_AdvancedFeatures_CheckedChanged)
				$Treeview.remove_AfterLabelEdit($CreateOU)
				$Treeview.remove_BeforeCheck($Treeview_BeforeCheck)
				$Treeview.remove_AfterCheck($Treeview_AfterCheck)
				$Treeview.remove_BeforeExpand($Treeview_BeforeExpand)
				$Treeview.remove_NodeMouseClick($Treeview_NodeMouseClick)
				$Treeview.remove_DoubleClick($Treeview_DoubleClick)
				$buttonOK.remove_Click($buttonOK_Click)
				$formChooseOU.remove_Load($FormEvent_Load)
				$formChooseOU.remove_Shown($formChooseOU_Shown)
				$changeDomainToolStripMenuItem.remove_Click($changeDomainToolStripMenuItem_Click)
				$newOUToolStripMenuItem.remove_Click($newOUToolStripMenuItem_Click)
				$formChooseOU.remove_Load($Form_StateCorrection_Load)
				$formChooseOU.remove_FormClosed($Form_Cleanup_FormClosed)
			}
			catch [Exception]
			{ }
		}
		#endregion Events
		
		#region Form Code
		
		#
		# formChooseOU
		#
		$formChooseOU.Controls.Add($cb_AdvancedFeatures)
		$formChooseOU.Controls.Add($Treeview)
		$formChooseOU.Controls.Add($buttonOK)
		$formChooseOU.AcceptButton = $buttonOK
		$formChooseOU.ClientSize = '342, 535'
		$formChooseOU.FormBorderStyle = 'FixedDialog'
		#region Binary Data
		$formChooseOU.Icon = [System.Convert]::FromBase64String('
AAABAAkAICAQAAEABADoAgAAlgAAABgYEAABAAQA6AEAAH4DAAAQEBAAAQAEACgBAABmBQAAICAA
AAEACACoCAAAjgYAABgYAAABAAgAyAYAADYPAAAQEAAAAQAIAGgFAAD+FQAAICAAAAEAIACoEAAA
ZhsAABgYAAABACAAiAkAAA4sAAAQEAAAAQAgAGgEAACWNQAAKAAAACAAAABAAAAAAQAEAAAAAAAA
AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIAAAACAgACAAAAAgACAAICAAACAgIAAwMDAAAAA
/wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAiIAAAAAAAAAAAAAAAACIiIiHMAAAAAAAAAAAAAiI//iIiHcAAAAAAAAAAIiP//+IiIiH
dwAAAAAAiI//////iIiIiHhwAAAAAIj///////iIiIiHeHAAAACIj////4iIiIiIiIiHgAAAiIj/
iIiIiIj/iIiHeIcAAIiIiIiIiIiIiP+IiIeIcACIiHd3d3d3eIeI+IiHeIhwczMRMzd3czeIeI/4
iIiIcAczN3iIiIczeId4j4iHiHAACIiP///4i7OIh4iPiHiAAAAIiI//iIu7M4h3iP+HcAAAAAiI
iIi7u7u3iHiIiHAAAAAACIeP///4i7iHeIgAAAAAAAAAiI+IiLu7t3AAAAAAAAAAAACDMzMzMzM3
AAAAAAAAAAAAAAAAAAAACIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////////////////////////////////
///////8f///wB///gAP//AAA/8AAAH/AAAAfwAAAB8AAAAPAAAABwAAAAEAAAABgAAAAeAAAAH4
AAAB/gAAAf+AAAP/8AAf//wAD////+f/////////////////////KAAAABgAAAAwAAAAAQAEAAAA
AAAgAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIAAAACAgACAAAAAgACAAICAAACAgIAAwMDA
AAAA/wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIiIAAAAAAAA
AAAIiIiIcAAAAAAAAIiI/4iIhwAAAAAIiP//+IiIh3gAAACI/////4iHiHeAAACIj//4iIiIeIiI
AACIiIi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/W7zV/1G20v9Jss//aNDm/zOixf8AAAAAAAAAAAAA
AAAAAAAAQouh/3issv9vqbH/ZqWv/1yirf9Tnqv/SZqq/z+XqP82k6b/LZCl/yWNo/8AX4L/AAAA
AAAAAAAAAAAAAAAAAEKLof9Ci6H/Qouh/0KLof9Ci6H/Qouh/0KLof9Ci6H/Qouh/0KLof9Ci6H/
Qouh/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAMADAADAAwAAwAMAAMADAADAAwAAwAMAAMADAADAAwAAwAMAAMAD
AADAAwAAwAMAAMADAADAAwAAwAMAAP//AAA=')
		#endregion
		$formChooseOU.MaximizeBox = $False
		$formChooseOU.MinimizeBox = $False
		$formChooseOU.Name = "formChooseOU"
		$formChooseOU.StartPosition = 'CenterParent'
		$formChooseOU.Text = "Choose Active Directory OU"
		$formChooseOU.add_Load($FormEvent_Load)
		$formChooseOU.add_Shown($formChooseOU_Shown)
		#
		# cb_AdvancedFeatures
		#
		$cb_AdvancedFeatures.Location = '19, 11'
		$cb_AdvancedFeatures.Name = "cb_AdvancedFeatures"
		$cb_AdvancedFeatures.Size = '137, 24'
		$cb_AdvancedFeatures.TabIndex = 3
		$cb_AdvancedFeatures.Text = "Advanced Features"
		$cb_AdvancedFeatures.UseVisualStyleBackColor = $True
		$cb_AdvancedFeatures.add_CheckedChanged($cb_AdvancedFeatures_CheckedChanged)
		#
		# Treeview
		#
		$Treeview.Anchor = 'Top, Bottom, Left, Right'
		$Treeview.ImageIndex = 1
		$Treeview.ImageList = $imagelist
		$Treeview.Location = '19, 37'
		$Treeview.Name = "Treeview"
		$System_Windows_Forms_TreeNode_1 = New-Object 'System.Windows.Forms.TreeNode' ("Active Directory Hierarchy", 1, 1)
		$System_Windows_Forms_TreeNode_1.ImageIndex = 1
		$System_Windows_Forms_TreeNode_1.Name = "Active Directory Hierarchy"
		$System_Windows_Forms_TreeNode_1.SelectedImageIndex = 1
		$System_Windows_Forms_TreeNode_1.Tag = "root"
		$System_Windows_Forms_TreeNode_1.Text = "Active Directory Hierarchy"
		[void]$Treeview.Nodes.Add($System_Windows_Forms_TreeNode_1)
		$Treeview.SelectedImageIndex = 1
		$Treeview.Size = '301, 442'
		$Treeview.TabIndex = 1
		$Treeview.add_AfterLabelEdit($CreateOU)
		$Treeview.add_BeforeCheck($Treeview_BeforeCheck)
		$Treeview.add_AfterCheck($Treeview_AfterCheck)
		$Treeview.add_BeforeExpand($Treeview_BeforeExpand)
		$Treeview.add_NodeMouseClick($Treeview_NodeMouseClick)
		$Treeview.add_DoubleClick($Treeview_DoubleClick)
		#
		# buttonOK
		#
		$buttonOK.Anchor = 'Bottom, Right'
		$buttonOK.DialogResult = 'OK'
		$buttonOK.Location = '245, 500'
		$buttonOK.Name = "buttonOK"
		$buttonOK.Size = '75, 23'
		$buttonOK.TabIndex = 0
		$buttonOK.Text = "OK"
		$buttonOK.UseVisualStyleBackColor = $True
		$buttonOK.add_Click($buttonOK_Click)
		#
		# imagelist
		#
		$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
AAAADwMAAABwCgAAAk1TRnQBSQFMAgEBBAEAAWABAAFgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2
AQQGAAE2AQQCAAEoAwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABA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gAZoCdAV5Av8BeQGaBBoBdAOaApkBmgF5A/8BmQMaApkDeQFYAXkBUgP/A/QB
8gG8AfECvAHvAfAE9AL/AZkBmgQaAXQDmgKZAZoBeQL/AZkGeQGaAvYB1gG0AZoBeQP/AVEBHAF5
A3QBUgRRASoG/wH0AbwB9wESAewB7wHwBv8BGwZ5AZoC9gHWAbQBmgGZCP8BmgZ5AZoD/wxRBv8B
9AG8AQcC7wH3AfEM/wHDBnkBw0H/AUIBTQE+BwABPgMAASgDAAFAAwABIAMAAQEBAAEBBgABARYA
A///AAIACw=='))
		#endregion
		$imagelist.ImageStream = $Formatter_binaryFomatter.Deserialize($System_IO_MemoryStream)
		$Formatter_binaryFomatter = $null
		$System_IO_MemoryStream = $null
		$imagelist.TransparentColor = 'Transparent'
		#
		# ContextMenu
		#
		[void]$ContextMenu.Items.Add($changeDomainToolStripMenuItem)
		[void]$ContextMenu.Items.Add($newOUToolStripMenuItem)
		$ContextMenu.Name = "ContextMenu"
		$ContextMenu.Size = '170, 26'
		#
		# changeDomainToolStripMenuItem
		#
		$changeDomainToolStripMenuItem.Name = "changeDomainToolStripMenuItem"
		$changeDomainToolStripMenuItem.Size = '169, 22'
		$changeDomainToolStripMenuItem.Text = "Change Domain..."
		$changeDomainToolStripMenuItem.add_Click($changeDomainToolStripMenuItem_Click)
		#
		# newOUToolStripMenuItem
		#
		$newOUToolStripMenuItem.Name = "newOUToolStripMenuItem"
		$newOUToolStripMenuItem.Size = '203, 22'
		$newOUToolStripMenuItem.Text = "New Organizational Unit"
		$newOUToolStripMenuItem.add_Click($newOUToolStripMenuItem_Click)
		#endregion Form Code
		
		#Save the initial state of the form
		$InitialFormWindowState = $formChooseOU.WindowState
		#Init the OnLoad event to correct the initial state of the form
		$formChooseOU.add_Load($Form_StateCorrection_Load)
		#Clean up the control events
		$formChooseOU.add_FormClosed($Form_Cleanup_FormClosed)
		#Show the Form
		$formChooseOU.ShowDialog() | Out-Null
		return $SelectedObject
		
	} #End Function Choose-ADOrganizationalUnit
	$comboboxdeploytype_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	$richtextboxStatus_TextChanged={
		#TODO: Place custom script here
		Update-NavButtons
	}
	
	# --End User Generated Script--
	#----------------------------------------------
	#region Generated Events
	#----------------------------------------------
	
	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$formKURZDeploymentTool.WindowState = $InitialFormWindowState
	}
	
	$Form_Cleanup_FormClosed=
	{
		#Remove all event handlers from the controls
		try
		{
			$richtextboxStatus.remove_TextChanged($richtextboxStatus_TextChanged)
			$buttonBack.remove_Click($buttonBack_Click)
			$buttonFinish.remove_Click($buttonFinish_Click)
			$textboxInOU.remove_TextChanged($textboxinOU_TextChanged)
			$textboxInOU.remove_Enter($textboxinOu_enter)
			$textboxInstallName.remove_TextChanged($textboxInstallName_TextChanged)
			$textboxUninstallName.remove_TextChanged($textboxUninstallName_TextChanged)
			$textboxUnOU.remove_TextChanged($textboxUnOU_TextChanged)
			$textboxUnOU.remove_Enter($textboxunOu_enter)
			$comboboxdeploytype.remove_TextChanged($comboboxdeploytype_TextChanged)
			$textboxAppName.remove_TextChanged($textboxappName_TextChanged)
			$textboxAppName.remove_Enter($textboxAppName_Enter)
			$tabcontrolWizard.remove_Selecting($tabcontrolWizard_Selecting)
			$tabcontrolWizard.remove_Deselecting($tabcontrolWizard_Deselecting)
			$buttonNext.remove_Click($buttonNext_Click)
			$formKURZDeploymentTool.remove_Load($formKURZDeploymentTool_Load)
			$openfiledialog1.remove_FileOk($openfiledialog1_FileOk)
			$formKURZDeploymentTool.remove_Load($Form_StateCorrection_Load)
			$formKURZDeploymentTool.remove_FormClosed($Form_Cleanup_FormClosed)
		}
		catch { Out-Null <# Prevent PSScriptAnalyzer warning #> }
	}
	#endregion Generated Events

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	$formKURZDeploymentTool.SuspendLayout()
	$trackbar1.BeginInit()
	$tabcontrolWizard.SuspendLayout()
	$tabpageStep1.SuspendLayout()
	$ADGroup.SuspendLayout()
	$groupbox6.SuspendLayout()
	$tabpageStep2.SuspendLayout()
	$groupbox2.SuspendLayout()
	#
	# formKURZDeploymentTool
	#
	$formKURZDeploymentTool.Controls.Add($textboxstat)
	$formKURZDeploymentTool.Controls.Add($trackbar1)
	$formKURZDeploymentTool.Controls.Add($richtextboxStatus)
	$formKURZDeploymentTool.Controls.Add($buttonCancel)
	$formKURZDeploymentTool.Controls.Add($buttonBack)
	$formKURZDeploymentTool.Controls.Add($buttonFinish)
	$formKURZDeploymentTool.Controls.Add($tabcontrolWizard)
	$formKURZDeploymentTool.Controls.Add($buttonNext)
	$formKURZDeploymentTool.AcceptButton = $buttonFinish
	$formKURZDeploymentTool.AutoScaleDimensions = '6, 13'
	$formKURZDeploymentTool.AutoScaleMode = 'Font'
	$formKURZDeploymentTool.CancelButton = $buttonCancel
	$formKURZDeploymentTool.ClientSize = '718, 645'
	$formKURZDeploymentTool.FormBorderStyle = 'FixedDialog'
	$formKURZDeploymentTool.MaximizeBox = $False
	$formKURZDeploymentTool.Name = 'formKURZDeploymentTool'
	$formKURZDeploymentTool.StartPosition = 'CenterScreen'
	$formKURZDeploymentTool.Text = 'KURZ Deployment Tool'
	$formKURZDeploymentTool.add_Load($formKURZDeploymentTool_Load)
	#
	# textboxstat
	#
	$textboxstat.Location = '144, 610'
	$textboxstat.Name = 'textboxstat'
	$textboxstat.Size = '319, 20'
	$textboxstat.TabIndex = 20
	#
	# trackbar1
	#
	$trackbar1.Location = '-97, -36'
	$trackbar1.Name = 'trackbar1'
	$trackbar1.Size = '104, 45'
	$trackbar1.TabIndex = 19
	#
	# richtextboxStatus
	#
	$richtextboxStatus.Location = '94, 610'
	$richtextboxStatus.Name = 'richtextboxStatus'
	$richtextboxStatus.Size = '35, 23'
	$richtextboxStatus.TabIndex = 18
	$richtextboxStatus.Text = ''
	$richtextboxStatus.add_TextChanged($richtextboxStatus_TextChanged)
	#
	# buttonCancel
	#
	$buttonCancel.Anchor = 'Bottom, Right'
	$buttonCancel.DialogResult = 'Cancel'
	$buttonCancel.Location = '550, 610'
	$buttonCancel.Name = 'buttonCancel'
	$buttonCancel.Size = '75, 23'
	$buttonCancel.TabIndex = 4
	$buttonCancel.Text = '&Cancel'
	$buttonCancel.UseCompatibleTextRendering = $True
	$buttonCancel.UseVisualStyleBackColor = $True
	#
	# buttonBack
	#
	$buttonBack.Anchor = 'Bottom, Left'
	$buttonBack.Location = '13, 610'
	$buttonBack.Name = 'buttonBack'
	$buttonBack.Size = '75, 23'
	$buttonBack.TabIndex = 1
	$buttonBack.Text = '< &Back'
	$buttonBack.UseCompatibleTextRendering = $True
	$buttonBack.UseVisualStyleBackColor = $True
	$buttonBack.add_Click($buttonBack_Click)
	#
	# buttonFinish
	#
	$buttonFinish.Anchor = 'Bottom, Right'
	$buttonFinish.DialogResult = 'OK'
	$buttonFinish.Location = '631, 610'
	$buttonFinish.Name = 'buttonFinish'
	$buttonFinish.Size = '75, 23'
	$buttonFinish.TabIndex = 3
	$buttonFinish.Text = '&Finish'
	$buttonFinish.UseCompatibleTextRendering = $True
	$buttonFinish.UseVisualStyleBackColor = $True
	$buttonFinish.add_Click($buttonFinish_Click)
	#
	# tabcontrolWizard
	#
	$tabcontrolWizard.Controls.Add($tabpageStep1)
	$tabcontrolWizard.Controls.Add($tabpageStep2)
	$tabcontrolWizard.Anchor = 'Top, Bottom, Left, Right'
	$tabcontrolWizard.Location = '13, 12'
	$tabcontrolWizard.Name = 'tabcontrolWizard'
	$tabcontrolWizard.SelectedIndex = 0
	$tabcontrolWizard.Size = '693, 592'
	$tabcontrolWizard.TabIndex = 0
	$tabcontrolWizard.add_Selecting($tabcontrolWizard_Selecting)
	$tabcontrolWizard.add_Deselecting($tabcontrolWizard_Deselecting)
	#
	# tabpageStep1
	#
	$tabpageStep1.Controls.Add($labelOU)
	$tabpageStep1.Controls.Add($textboxInOU)
	$tabpageStep1.Controls.Add($textboxInstallName)
	$tabpageStep1.Controls.Add($labelName)
	$tabpageStep1.Controls.Add($ADGroup)
	$tabpageStep1.Location = '4, 22'
	$tabpageStep1.Name = 'tabpageStep1'
	$tabpageStep1.Padding = '3, 3, 3, 3'
	$tabpageStep1.Size = '685, 566'
	$tabpageStep1.TabIndex = 0
	$tabpageStep1.Text = 'Step 1'
	$tabpageStep1.UseVisualStyleBackColor = $True
	#
	# labelOU
	#
	$labelOU.AutoSize = $True
	$labelOU.Location = '12, 94'
	$labelOU.Name = 'labelOU'
	$labelOU.Size = '24, 17'
	$labelOU.TabIndex = 6
	$labelOU.Text = 'OU:'
	$labelOU.UseCompatibleTextRendering = $True
	#
	# textboxInOU
	#
	$textboxInOU.Location = '93, 87'
	$textboxInOU.Name = 'textboxInOU'
	$textboxInOU.Size = '259, 20'
	$textboxInOU.TabIndex = 2
	$textboxInOU.add_TextChanged($textboxinOU_TextChanged)
	$textboxInOU.add_Enter($textboxinOu_enter)
	#
	# textboxInstallName
	#
	$textboxInstallName.Location = '93, 61'
	$textboxInstallName.Name = 'textboxInstallName'
	$textboxInstallName.Size = '259, 20'
	$textboxInstallName.TabIndex = 1
	$textboxInstallName.add_TextChanged($textboxInstallName_TextChanged)
	#
	# labelName
	#
	$labelName.AutoSize = $True
	$labelName.Location = '12, 64'
	$labelName.Name = 'labelName'
	$labelName.Size = '38, 17'
	$labelName.TabIndex = 0
	$labelName.Text = 'Name:'
	$labelName.UseCompatibleTextRendering = $True
	#
	# ADGroup
	#
	$ADGroup.Controls.Add($groupbox6)
	$ADGroup.Controls.Add($groupbox5)
	$ADGroup.Location = '4, 19'
	$ADGroup.Name = 'ADGroup'
	$ADGroup.Size = '675, 547'
	$ADGroup.TabIndex = 10
	$ADGroup.TabStop = $False
	$ADGroup.Text = 'AD-Group:'
	$ADGroup.UseCompatibleTextRendering = $True
	#
	# groupbox6
	#
	$groupbox6.Controls.Add($labelLanguage)
	$groupbox6.Controls.Add($textboxUninstallName)
	$groupbox6.Controls.Add($labelAppName)
	$groupbox6.Controls.Add($textboxUnOU)
	$groupbox6.Location = '5, 124'
	$groupbox6.Name = 'groupbox6'
	$groupbox6.Size = '363, 139'
	$groupbox6.TabIndex = 10
	$groupbox6.TabStop = $False
	$groupbox6.Text = 'Uninstall:'
	$groupbox6.UseCompatibleTextRendering = $True
	#
	# labelLanguage
	#
	$labelLanguage.AutoSize = $True
	$labelLanguage.Location = '3, 52'
	$labelLanguage.Name = 'labelLanguage'
	$labelLanguage.Size = '24, 17'
	$labelLanguage.TabIndex = 8
	$labelLanguage.Text = 'OU:'
	$labelLanguage.UseCompatibleTextRendering = $True
	#
	# textboxUninstallName
	#
	$textboxUninstallName.Location = '84, 19'
	$textboxUninstallName.Name = 'textboxUninstallName'
	$textboxUninstallName.Size = '259, 20'
	$textboxUninstallName.TabIndex = 3
	$textboxUninstallName.add_TextChanged($textboxUninstallName_TextChanged)
	#
	# labelAppName
	#
	$labelAppName.AutoSize = $True
	$labelAppName.Location = '3, 26'
	$labelAppName.Name = 'labelAppName'
	$labelAppName.Size = '38, 17'
	$labelAppName.TabIndex = 7
	$labelAppName.Text = 'Name:'
	$labelAppName.UseCompatibleTextRendering = $True
	#
	# textboxUnOU
	#
	$textboxUnOU.Location = '84, 45'
	$textboxUnOU.Name = 'textboxUnOU'
	$textboxUnOU.Size = '259, 20'
	$textboxUnOU.TabIndex = 4
	$textboxUnOU.add_TextChanged($textboxUnOU_TextChanged)
	$textboxUnOU.add_Enter($textboxunOu_enter)
	#
	# groupbox5
	#
	$groupbox5.Location = '5, 19'
	$groupbox5.Name = 'groupbox5'
	$groupbox5.Size = '364, 99'
	$groupbox5.TabIndex = 9
	$groupbox5.TabStop = $False
	$groupbox5.Text = 'Install:'
	$groupbox5.UseCompatibleTextRendering = $True
	#
	# tabpageStep2
	#
	$tabpageStep2.Controls.Add($progressbar1)
	$tabpageStep2.Controls.Add($labelDeploymentType)
	$tabpageStep2.Controls.Add($groupbox2)
	$tabpageStep2.Location = '4, 22'
	$tabpageStep2.Name = 'tabpageStep2'
	$tabpageStep2.Padding = '3, 3, 3, 3'
	$tabpageStep2.Size = '685, 566'
	$tabpageStep2.TabIndex = 1
	$tabpageStep2.Text = 'Step 2'
	$tabpageStep2.UseVisualStyleBackColor = $True
	#
	# progressbar1
	#
	$progressbar1.Location = '8, 454'
	$progressbar1.Name = 'progressbar1'
	$progressbar1.Size = '671, 23'
	$progressbar1.TabIndex = 18
	#
	# labelDeploymentType
	#
	$labelDeploymentType.AutoSize = $True
	$labelDeploymentType.Location = '6, 84'
	$labelDeploymentType.Name = 'labelDeploymentType'
	$labelDeploymentType.Size = '96, 17'
	$labelDeploymentType.TabIndex = 4
	$labelDeploymentType.Text = 'Deployment Type:'
	$labelDeploymentType.UseCompatibleTextRendering = $True
	#
	# groupbox2
	#
	$groupbox2.Controls.Add($datetimestart)
	$groupbox2.Controls.Add($labelDeploymentStarttime)
	$groupbox2.Controls.Add($comboboxdeploytype)
	$groupbox2.Controls.Add($labelApplicationName)
	$groupbox2.Controls.Add($textboxAppName)
	$groupbox2.Location = '6, 18'
	$groupbox2.Name = 'groupbox2'
	$groupbox2.Size = '653, 192'
	$groupbox2.TabIndex = 17
	$groupbox2.TabStop = $False
	$groupbox2.Text = 'Deployment:'
	$groupbox2.UseCompatibleTextRendering = $True
	#
	# datetimestart
	#
	$datetimestart.Location = '120, 107'
	$datetimestart.Name = 'datetimestart'
	$datetimestart.Size = '121, 20'
	$datetimestart.TabIndex = 19
	#
	# labelDeploymentStarttime
	#
	$labelDeploymentStarttime.AutoSize = $True
	$labelDeploymentStarttime.Location = '0, 113'
	$labelDeploymentStarttime.Name = 'labelDeploymentStarttime'
	$labelDeploymentStarttime.Size = '116, 17'
	$labelDeploymentStarttime.TabIndex = 18
	$labelDeploymentStarttime.Text = 'Deployment Starttime:'
	$labelDeploymentStarttime.UseCompatibleTextRendering = $True
	#
	# comboboxdeploytype
	#
	$comboboxdeploytype.FormattingEnabled = $True
	[void]$comboboxdeploytype.Items.Add('Available')
	[void]$comboboxdeploytype.Items.Add('Required')
	$comboboxdeploytype.Location = '120, 66'
	$comboboxdeploytype.Name = 'comboboxdeploytype'
	$comboboxdeploytype.Size = '121, 21'
	$comboboxdeploytype.TabIndex = 4
	$comboboxdeploytype.add_TextChanged($comboboxdeploytype_TextChanged)
	#
	# labelApplicationName
	#
	$labelApplicationName.AutoSize = $True
	$labelApplicationName.Location = '2, 24'
	$labelApplicationName.Name = 'labelApplicationName'
	$labelApplicationName.Size = '97, 17'
	$labelApplicationName.TabIndex = 2
	$labelApplicationName.Text = 'Application-Name:'
	$labelApplicationName.UseCompatibleTextRendering = $True
	#
	# textboxAppName
	#
	$textboxAppName.Location = '120, 21'
	$textboxAppName.Name = 'textboxAppName'
	$textboxAppName.Size = '224, 20'
	$textboxAppName.TabIndex = 3
	$textboxAppName.add_TextChanged($textboxappName_TextChanged)
	$textboxAppName.add_Enter($textboxAppName_Enter)
	#
	# buttonNext
	#
	$buttonNext.Anchor = 'Bottom, Right'
	$buttonNext.Location = '469, 610'
	$buttonNext.Name = 'buttonNext'
	$buttonNext.Size = '75, 23'
	$buttonNext.TabIndex = 2
	$buttonNext.Text = '&Next >'
	$buttonNext.UseCompatibleTextRendering = $True
	$buttonNext.UseVisualStyleBackColor = $True
	$buttonNext.add_Click($buttonNext_Click)
	#
	# openfiledialog1
	#
	$openfiledialog1.FileName = 'openfiledialog1'
	$openfiledialog1.add_FileOk($openfiledialog1_FileOk)
	#
	# colordialog1
	#
	#
	# errorprovider1
	#
	$errorprovider1.ContainerControl = $formKURZDeploymentTool
	$groupbox2.ResumeLayout()
	$tabpageStep2.ResumeLayout()
	$groupbox6.ResumeLayout()
	$ADGroup.ResumeLayout()
	$tabpageStep1.ResumeLayout()
	$tabcontrolWizard.ResumeLayout()
	$trackbar1.EndInit()
	$formKURZDeploymentTool.ResumeLayout()
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $formKURZDeploymentTool.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$formKURZDeploymentTool.add_Load($Form_StateCorrection_Load)
	#Clean up the control events
	$formKURZDeploymentTool.add_FormClosed($Form_Cleanup_FormClosed)
	#Show the Form
	return $formKURZDeploymentTool.ShowDialog()

} #End Function

#Call the form
Show-appdeployapplication_psf | Out-Null

For the XML-File:


<?xml version="1.0"?>
<MP>
<Name>Sccmservername.domain</Name>
<Code>PS1:\</Code>
<module>C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1</module>
<domainname>AD-Domainname</domainname>
</MP>