DeployEverything HP Driver Download Automation Tool

Automate the process of downloading HP driver packages into SCCM & MDT using the DeployEverything HP Driver Automation Tool PS script.

The tool automates the following processes;

  1. Downloads the HP SCCM Driver Pack Cabinet
  2. Extracts the contained XML and reads in the file
  3. Displays HP Driver Packages based on the OS selection within the GUI
  4. Creates Folders For Each Model
  5. Downloads the selected model SoftPaq’s
  6. Extracts the SoftPaqs
  7. Imports the SoftPaqs into SCCM, MDT or Both
  8. Create a Category based on the machine model
  9. Create a Driver Package based on the machine model and OS
  10. Imports the associated drivers into the newly created Driver Package

<# .NOTES ——————————————————————————– Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.134 Generated on: 03/02/2017 08:30 Generated by: Maurice.Daly File Name: HPAutoDownloadGUI.ps1 Version: 1.0 ——————————————————————————– .DESCRIPTION This script allows you to automate the process of keeping your HP driver packs up to date on both your SCCM and MDT installations. The script reads the HP Driver Cabinet XML for models you have specified and then downloads the corresponding latest driver packs and BIOS updates.

	The script generates a GUI allowing you to select features such as SCCM or
	MDT import jobs, Operating System, Driver bit type etc.
	
	Use : This script is provided as it and I accept no responsibility for any issues arising from its use.
 
	Twitter : @modaly\_it
	Blog : http://deployeverything.com
 
	Credits
	MDT Import Script Source - https://scriptimus.wordpress.com/2012/06/18/mdt-powershell-importing-drivers/

	ChangeLog
	
	Version 1.0 Initial Release

#>

#region Source: Startup.pss #———————————————- #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)
	
if((Show-MainForm\_psf) -eq 'OK')
{
	
}

$script:ExitCode = 0 #Set the exit code for the Packager }

#endregion Source: Startup.pss

#region Source: MainForm.psf function Show-MainForm_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’) [void][reflection.assembly]::Load(‘System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’) #endregion Import Assemblies

#----------------------------------------------
#region Define SAPIEN Types
#----------------------------------------------
try{
	\[ProgressBarOverlay\] | Out-Null
}
catch
{
	Add-Type -ReferencedAssemblies ('System.Windows.Forms', 'System.Drawing') -TypeDefinition  @" 
	using System;
	using System.Windows.Forms;
	using System.Drawing;
    namespace SAPIENTypes
    {
	    public class ProgressBarOverlay : System.Windows.Forms.ProgressBar
        {
            public ProgressBarOverlay() : base() { SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); }
            protected override void WndProc(ref Message m)
            { 
                base.WndProc(ref m);
                if (m.Msg == 0x000F)// WM\_PAINT
                {
                    if (Style != System.Windows.Forms.ProgressBarStyle.Marquee || !string.IsNullOrEmpty(this.Text))
                    {
                        using (Graphics g = this.CreateGraphics())
                        {
                            using (StringFormat stringFormat = new StringFormat(StringFormatFlags.NoWrap))
                            {
                                stringFormat.Alignment = StringAlignment.Center;
                                stringFormat.LineAlignment = StringAlignment.Center;
                                if (!string.IsNullOrEmpty(this.Text))
                                    g.DrawString(this.Text, this.Font, Brushes.Black, this.ClientRectangle, stringFormat);
                                else
                                {
                                    int percent = (int)(((double)Value / (double)Maximum) \* 100);
                                    g.DrawString(percent.ToString() + "%", this.Font, Brushes.Black, this.ClientRectangle, stringFormat);
                                }
                            }
                        }
                    }
                }
            }
          
            public string TextOverlay
            {
                get
                {
                    return base.Text;
                }
                set
                {
                    base.Text = value;
                    Invalidate();
                }
            }
        }
    } "@ -IgnoreWarnings | Out-Null
}
#endregion Define SAPIEN Types

#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
\[System.Windows.Forms.Application\]::EnableVisualStyles()
$MainForm = New-Object 'System.Windows.Forms.Form'
$DeployEverythingcomLink = New-Object 'System.Windows.Forms.LinkLabel'
$SCCMDellTabControl = New-Object 'System.Windows.Forms.TabControl'
$SCCMTabPage1 = New-Object 'System.Windows.Forms.TabPage'
$SiteCodeLabel = New-Object 'System.Windows.Forms.Label'
$SiteCodeText = New-Object 'System.Windows.Forms.TextBox'
$SiteServerLabel = New-Object 'System.Windows.Forms.Label'
$SiteServerInput = New-Object 'System.Windows.Forms.TextBox'
$ConnectSCCMButton = New-Object 'System.Windows.Forms.Button'
$labelPleaseNoteThisToolIs = New-Object 'System.Windows.Forms.Label'
$ClearSelectionButton = New-Object 'System.Windows.Forms.Button'
$ModelProgressOverlay = New-Object 'SAPIENTypes.ProgressBarOverlay'
$ProgressBar = New-Object 'System.Windows.Forms.ProgressBar'
$ProgressListBox = New-Object 'System.Windows.Forms.ListBox'
$AboutToolLabel = New-Object 'System.Windows.Forms.Label'
$AutomationLabel = New-Object 'System.Windows.Forms.Label'
$picturebox1 = New-Object 'System.Windows.Forms.PictureBox'
$ProductListBox = New-Object 'System.Windows.Forms.ListBox'
$StartDownloadButton = New-Object 'System.Windows.Forms.Button'
$DownloadGroupBox = New-Object 'System.Windows.Forms.GroupBox'
$ArchitectureComboxBox = New-Object 'System.Windows.Forms.ComboBox'
$DownloadComboBox = New-Object 'System.Windows.Forms.ComboBox'
$PlatformComboBox = New-Object 'System.Windows.Forms.ComboBox'
$PackagePathTextBox = New-Object 'System.Windows.Forms.TextBox'
$RepositoryTextBox = New-Object 'System.Windows.Forms.TextBox'
$ArchitectureCheckBox = New-Object 'System.Windows.Forms.Label'
$lSelectDeployLabel = New-Object 'System.Windows.Forms.Label'
$OSComboBox = New-Object 'System.Windows.Forms.ComboBox'
$labelDownloadType = New-Object 'System.Windows.Forms.Label'
$OperatingSysLabel = New-Object 'System.Windows.Forms.Label'
$RepositoryLabel = New-Object 'System.Windows.Forms.Label'
$PackagePathLabel = New-Object 'System.Windows.Forms.Label'
$ModelListBox = New-Object 'System.Windows.Forms.Label'
$ModelProgressLabel = New-Object 'System.Windows.Forms.Label'
$LoggingLabel = New-Object 'System.Windows.Forms.Label'
$OpenMDTFileDialog = New-Object 'System.Windows.Forms.OpenFileDialog'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects

#----------------------------------------------
# User Generated Script
#----------------------------------------------

$MainForm\_Load = {
	
	# Start Job Log Window
	$ProgressListBox.Items.Add("======== Initialising DeployEverything HP Driver Automation Tool ======== ")
	$ProgressListBox.Items.Add(" ")
	
	# Create Log File	
	Get-Date -Format F | Out-File -FilePath $LogFile -Append
	Add-Content -Path $LogFile "Logging Running....."
	
	# Set SCCM Site Server To Local Machine
	$SiteServerInput.Text = $env:COMPUTERNAME
	$PlatformComboBox.SelectedItem = "SCCM"
	$DownloadComboBox.SelectedItem = "Drivers"
	$OSComboBox.SelectedItem = "Windows 10"
	$ArchitectureComboxBox.SelectedItem = "64 bit"
}

$StartDownloadButton\_Click = {
	
	# Set Variables Retrieved From GUI
	$ImportInto = \[string\]$PlatformComboBox.SelectedItem
	$DownloadType = \[string\]$DownloadComboBox.SelectedItem
	$HPProducts = $ProductListBox.SelectedItems
	$SiteCode = $SiteCodeText.Text
	
	# Read in HP Model Lists - For Downloading Softpaq's
	\[xml\]$HPModelXML = Get-Content -Path $env:TEMP\\$HPXMLFile
	# Set XML Object
	$HPModelXML.GetType().FullName
	$HPModelSoftPaqs = $HPModelXML.newdataset.hpclientdriverpackcatalog.softpaqlist.softpaq
	
	# Set Initial Validation State
	$ValidationErrors = 0
	
	# ============ Validation Selection Details and Prerequisites ==============
	
	# Reset Job Process Log Dialog 
	if (($ProgressListBox.ForeColor) -eq "Red") { $ProgressListBox.Items.Clear() }
	
	# Validate Selected Models
	if (($ProductListBox.SelectedItems.Count) -lt "1")
	{
		$ProgressListBox.ForeColor = "Red"
		$ProgressListBox.Items.Add("Error: No Models Selected")
		$ValidationErrors++
	}
	
	# Validate Repository Path For BIOS & Driver Downloads
	if ((Test-Path -Path $RepositoryTextBox.Text) -eq $true)
	{
		$RepositoryPath = \[string\]$RepositoryTextBox.Text
		$ProgressListBox.Items.Add("MDT: Respository Path Set To $RepositoryPath")
	}
	else
	{
		$ProgressListBox.ForeColor = "Red"
		$ProgressListBox.Items.Add("Error: UNC Repository Path Specified Could Not Be Found $($RepositoryTextBox.Text)")
		$ValidationErrors++
	}
	
	# Validate Package Path For SCCM Driver Imports
	if (($ImportInto) -ne "MDT")
	{
		if ((Test-Path -path $PackagePathTextBox.Text) -eq $true)
		{
			$PackagePath = \[string\]$PackagePathTextBox.Text
		}
		else
		{
			$ProgressListBox.ForeColor = "Red"
			$ProgressListBox.Items.Add("Error: UNC Package Path Specified Could Not Be Found $($PackagePathTextBox.Text)")
			$ValidationErrors++
		}
	}
	
	# Validate OS Selection
	if (($OSComboBox).SelectedIndex -ne $null)
	{
		$WindowsVersion = (\[string\]($OSComboBox).SelectedItem).Trim("Windows ")
	}
	else
	{
		$ProgressListBox.ForeColor = "Red"
		$ProgressListBox.Items.Add("Error: Operating System Not Specified")
		$ValidationErrors++
	}
	
	# Validate OS Architecture Selection
	if (($ArchitectureComboxBox).SelectedItem -ne $null)
	{
		$Architecture = "x" + (\[string\]$ArchitectureComboxBox.SelectedItem).Trim(" bit")
	}
	else
	{
		$ProgressListBox.ForeColor = "Red"
		$ProgressListBox.Items.Add("Error: Operating System Architecture Not Specified")
		$ValidationErrors++
	}
	
	#$ProgressListBox.Items.Add("DEBUG: Validation Errors $ValidationErrors")
	
	# Validate MDT PowerShell Commandlets / Install 
	if ((($ImportInto) -eq ("MDT" -or "Both")) -and ($ValidationErrors -eq 0))
	{
		# Validate MDT PS Commandlets
		if ((Test-Path -Path $MDTPSCommandlets) -eq $true)
		{
			# Import MDT Module
			$ProgressListBox.Items.Add("Importing: MDT PowerShell Commandlets")
			Import-Module $MDTPSCommandlets
		}
		else
		{
			$ProgressListBox.ForeColor = "Red"
			$ProgressListBox.Items.Add("Error: MDT PowerShell Commandlets file not found at $MDTPSCommandlets")
			$ValidationErrors++
		}
	}
	
	# MDT Download ScriptBlock
	$DriverDownloadJob = {
		Param ($DriverRepositoryRoot,
			$Model,
			$HPSoftPaqFileName,
			$HPSoftPaqURL)
		
		# Replace FTP for HTTP for Bits Transfer Job
		$HPSoftPaqURL = "http:" + ($HPSoftPaqURL).TrimStart("ftp:")
		
		# Start SoftPaq Download
		$ProgressListBox.Items.Add("DEBUG: Downloading $HPSoftPaqURL to $DriverRepositoryRoot $Model \\Driver Cab\\ $HPSoftPaqFileName ")
		Start-BitsTransfer -DisplayName "SoftPaqDownload" -Source $HPSoftPaqURL -Destination $($DriverRepositoryRoot + $Model + "\\Driver Cab\\" + $HPSoftPaqFileName) -RetryTimeout 90 -RetryInterval 180
	}
	
	If ($ValidationErrors -eq 0)
	{
		# Test Package Path
		$ProgressListBox.Items.Clear()
		$ProgressListBox.ForeColor = "Black"
		$ProgressListBox.Items.Add("======== Starting Download Processes ======== ")
		$ProgressListBox.Items.Add(" ")
		$ProgressListBox.Items.Add("Models selected: $($ProductListBox.SelectedItems)")
		$ProgressListBox.Items.Add("Operating System specified: Windows $($WindowsVersion)")
		$ProgressListBox.Items.Add("Operating System architecture specified: $($Architecture)")
		$ProgressListBox.Items.Add(" ")
		$ProgressListBox.Items.Add("Site Code specified: $($SiteCode)")
		$ProgressListBox.Items.Add("Respository Path specified: $($RepositoryPath)")
		$ProgressListBox.Items.Add("Package Path specified: $($PackagePath)")
		
		# Operating System Version
		$OperatingSystem = ("Windows " + $WindowsVersion)
		$TotalModelCount = $HPProducts.Count
		$RemainingModels = $TotalModelCount
		
		# Initialise Job Progress Bar
		$ProgressBar.Maximum = $TotalModelCount
		$ModelProgressOverlay.Maximum = $TotalModelCount
		
		if ($ImportInto -ne "SCCM")
		{
			# Import MDT Module
			$ProgressListBox.Items.Add("IMPORT: Importing MDT PowerShell Module")
			Import-Module "C:\\Program Files\\Microsoft Deployment Toolkit\\bin\\MicrosoftDeploymentToolkit.psd1"
		}
		
		foreach ($Model in $HPProducts)
		{
			$Model = \[string\]$Model.Trim()
			$ProgressListBox.Items.Add("Processing HP Model: $Model")
			$ProgressListBox.Items.Add(" ")
			$HPSoftPaq = $HPModelSoftPaqs | Where-Object { $\_.Name -like "\*$Model\*$(($OSComboBox.Text).Split(' ')\[1\])\*$(($ArchitectureComboxBox.Text).Trim(' bit'))\*" }
			$HPSoftPaqURL = $HPSoftPaq.URL
			$ProgressListBox.Items.Add("HP SoftPaq URL $HPSoftPaqURL")
			$HPSoftPaqFileName = $HPSoftPaqURL | Split-Path -Leaf
			$DriverRevision = $HPSoftPaq.Version
			$ProgressListBox.Items.Add(" ")
			$ProgressListBox.Items.Add("Starting download,extract and import process for HP model $($Model)")
			
			# Correct slash direction issues
			$Model = $Model.Replace("/", "-")
			
			# =================== DEFINE VARIABLES =====================
			
			# Directory used for driver and BIOS downloads
			$DriverRepositoryRoot = ($RepositoryPath.Trimend("\\") + "\\HP\\")
			
			# Directory used by SCCM for driver packages
			If ($ImportInto -ne "MDT") { $DriverPackageRoot = ($PackagePath.Trimend("\\") + "\\HP\\") }
			
			#$DriverRevision = ($HPModelSoftPaqs).Version | Where-Object { $Model -like $HPModelSoftPaqs.Name }
			$DriverCategoryName = $Model + "," + $OperatingSystem + $DriverRevision
			$DriverExtractDest = ($DriverRepositoryRoot + $Model + "\\" + $DriverRevision)
			$DriverPackageDest = $DriverPackageRoot + "$Model"
			
			# =================== INITIATE DOWNLOADS ===================
			
			if (($ImportInto -eq "SCCM") -or ($ImportInto -eq "Both"))
			{
				
				if ($DownloadType -eq "Drivers")
				{
					# =============== SCCM Driver Cab Download =================
					
					$ProgressListBox.Items.Add(" ")
					$ProgressListBox.Items.Add("Retrieving SCCM Driver Pack Site For Model: $Model")
					#$ModelURL = ($HPModelSoftPaqs.URL) | Where-Object { ($Model -like "\*$($HPModelSoftPaqs.Name)\*$($OSComboBox.Text)\*$($Architecture.text)\*") }
					$ProgressListBox.Items.Add("URL Found: $HPSoftPaqURL")
					UpdateLogWindow
					
					If ($HPSoftPaqURL -ne $null)
					{
						
						# Check for destination directory, create if required and download the driver cab
						if ((Test-Path -Path ($DriverRepositoryRoot + $Model + "\\Driver Cab\\" + $HPSoftPaqFileName)) -eq $false)
						{
							$ProgressListBox.Items.Add("SCCM: Creating $Model download folder")
							if ((Test-Path -Path ($DriverRepositoryRoot + $Model + "\\Driver Cab")) -eq $false)
							{
								New-Item -Type dir -Path ($DriverRepositoryRoot + $Model + "\\Driver Cab")
							}
							$ProgressListBox.Items.Add("SCCM: Downloading $HPSoftPaqFileName driver cab file")
							UpdateLogWindow
							#$ProgressListBox.Items.Add("DEBUG: $DriverRepositoryRoot + $Model + '\\Driver Cab\\' + $HPSoftPaqFileName")
							#Start-BitsTransfer -DisplayName "$Model Driver Download" -Source ($SCCMDriverDownload.href) -Destination ($DriverRepositoryRoot + $Model + "\\Driver Cab\\" + $SCCMDriverCab) -RetryTimeout 90 -RetryInterval 180
							#Download SoftPaq Driver File
							$ProgressListBox.Items.Add("SCCM: Softpaq Driver Download Location Set To: $($DriverRepositoryRoot + $Model + '\\Driver Cab\\' + $HPSoftPaqFileName)")
							$ProgressListBox.Items.Add("SCCM: Downloading Softpaq From: $HPSoftPaqURL")
							Start-Job -Name "SoftPaqDownload" -ScriptBlock $DriverDownloadJob -ArgumentList ($DriverRepositoryRoot, $Model, $HPSoftPaqFileName, $HPSoftPaqURL)
							
							while ((Get-Job -Name "SoftPaqDownload").State -eq "Running")
							{
								$ProgressListBox.Items.Add("SCCM: Waiting For $HPSoftPaqFileName To Finish Downloading.. Next Check In 60 Seconds")
								UpdateLogWindow
								sleep -Seconds 60
							}
							
							$ProgressListBox.Items.Add("SCCM: SoftPaq Revision: $DriverRevision")
						}
						else
						{
							$ProgressListBox.Items.Add("SCCM: Skipping $SCCMDriverCab... Driver pack already downloaded...")
						}
						
						# =============== Create Driver Package + Import Drivers =================
						
						#$ProgressListBox.Items.Add("DEBUG Driver Package Location: $DriverCabDest")
						if ((Test-Path -Path $DriverPackageDest) -eq $false)
						{
							#New-Item -Type dir -Path $DriverExtractDest
							New-Item -Type dir -Path ($DriverPackageDest + "\\" + $Architecture)
							Set-Location -Path ($SiteCode + ":")
							$CMDDriverPackage = ($Model + " - " + $OperatingSystem + " " + $Architecture)
							$ProgressListBox.Items.Add("SCCM: Creating driver package")
							UpdateLogWindow
							Set-Location -Path $env:SystemDrive
							$ProgressListBox.Items.Add("SCCM: Expanding driver CAB")
							UpdateLogWindow
							
							# Extract Drivers From SoftPaq
							if ((Test-Path -Path $DriverExtractDest) -eq $false)
							{
								New-Item -Type dir -Path $DriverExtractDest
								$ProgressListBox.Items.Add("SCCM: Running SoftPaq: $($DriverRepositoryRoot + $Model + "\\Driver Cab\\" + $HPSoftPaqFileName)")
								$ProgressListBox.Items.Add("SCCM: Driver Extracting To: $DriverExtractDest")
								$SoftPaqSilentSwitches = "-PDF -F" + $env:TEMP + "\\" + $Model + " -S -E"
								Start-Process -FilePath $($DriverRepositoryRoot + $Model + "\\Driver Cab\\" + $HPSoftPaqFileName) -ArgumentList $SoftPaqSilentSwitches -Verb RunAs
								
								$SoftPaqProcess = $HPSoftPaqFileName.TrimEnd(".exe")
								
								$ProgressListBox.Items.Add(" ")
								$ProgressListBox.Items.Add("==================== SCCM DRIVER EXTRACT ====================")
								$ProgressListBox.Items.Add(" ")
								
								# Wait for HP SoftPaq Process To Finish
								While (Get-Process -Name $SoftPaqProcess)
								{
									$ProgressListBox.Items.Add("SCCM: Waiting For Extract Process To Complete..  Next Check In 30 Seconds")
									UpdateLogWindow
									sleep -Seconds 30
								}
								
								# Move Extracted Drivers
								$ProgressListBox.Items.Add("SCCM: Moving Extracted Drivers...")
								UpdateLogWindow
								
								Get-ChildItem -Path $env:TEMP\\$Model -Recurse | Move-Item -Destination $DriverExtractDest
							}
							else
							{
								$ProgressListBox.Items.Add("Skipping $HPSoftPaqFileName.. Drivers already extracted...")
							}
							
							$DriverINFFiles = Get-ChildItem -Path $DriverExtractDest -Recurse -Filter "\*.inf" | Where-Object { $\_.FullName -like "\*$Architecture\*" }
							
							Set-Location -Path ($SiteCode + ":")
							if (Get-CMCategory -CategoryType DriverCategories -name $DriverCategoryName)
							{
								$ProgressListBox.Items.Add("SCCM: Category Already Exists")
								$DriverCategory = Get-CMCategory -CategoryType DriverCategories -name $DriverCategoryName
							}
							else
							{
								$ProgressListBox.Items.Add("SCCM: Creating Category")
								$DriverCategory = New-CMCategory -CategoryType DriverCategories -name $DriverCategoryName
							}
							
							$ProgressListBox.Items.Add("SCCM: Creating Driver Package for $Model")
							$ProgressListBox.Items.Add(" ")
							$ProgressListBox.Items.Add("======== Adding Drivers To Package ======== ")
							$ProgressListBox.Items.Add(" ")
							UpdateLogWindow
							
							New-CMDriverPackage -Name $CMDDriverPackage -path ($DriverPackageDest + "\\" + $Architecture)
							Set-CMDriverPackage -Name $CMDDriverPackage -Version $DriverRevision
							$DriverPackage = Get-CMDriverPackage -Name $CMDDriverPackage
							
							# Import Driver Loop
							$DriverNo = 1
							foreach ($DriverINF in $DriverINFFiles)
							{
								$DriverInfo = Import-CMDriver -UncFileLocation ($DriverINF.FullName) -ImportDuplicateDriverOption AppendCategory -EnableAndAllowInstall $True -AdministrativeCategory $DriverCategory | Select-Object \*
								Add-CMDriverToDriverPackage -DriverID $DriverInfo.CI\_ID -DriverPackageName "$($CMDDriverPackage)" -WarningAction SilentlyContinue -ErrorAction SilentlyContinue
								$ProgressListBox.Items.Add("SCCM: Importing Driver INF $DriverNo Of $($DriverINFFiles.count): $($DriverINF.FullName | Split-Path -Leaf)")
								$DriverNo++
								UpdateLogWindow
							}
						}
						else
						{
							$ProgressListBox.Items.Add("SCCM: Driver Package Already Exists.. Skipping")
						}
						Set-Location -Path $env:SystemDrive
					}
					else
					{
						$ProgressListBox.Items.Add("Operating system driver package download path not found.. Skipping $Model")
					}
				}
			}
			
			if (($ImportInto -eq "Both") -or ($ImportInto -eq "MDT"))
			{
				
				# =================== MDT Driver Download =====================
				
				$ProgressListBox.Items.Add(" ")
				$ProgressListBox.Items.Add("==================== MDT Driver Download ====================")
				$ProgressListBox.Items.Add(" ")
				$ProgressListBox.Items.Add("Starting MDT Driver Download Process")
				UpdateLogWindow
				
				# =================== DEFINE VARIABLES =====================
				
				# Directory used for driver downloads
				$DriverRepositoryRoot = ($RepositoryPath.Trimend("\\") + "\\HP\\")
				$ProgressListBox.Items.Add("MDT: Driver Package Base Location Set To: $DriverRepositoryRoot")
				
				# Operating System Version
				$OperatingSystem = ("Windows " + $WindowsVersion)
				UpdateLogWindow
				
				# =============== MDT Driver Cab Download =================
				
				$ProgressListBox.Items.Add(" ")
				UpdateLogWindow
				
				If ($HPSoftPaq.URL -ne $HPBaseURL)
				{
					
					# Check for destination directory, create if required and download the driver cab
					if ((Test-Path -Path ($DriverRepositoryRoot + $Model + "\\Driver Cab\\" + $HPSoftPaqFileName)) -eq $false)
					{
						if ((Test-Path -Path ($DriverRepositoryRoot + $Model + "\\Driver Cab\\")) -eq $false)
						{
							$ProgressListBox.Items.Add("Creating $Model Download Folder")
							New-Item -Type dir -Path ($DriverRepositoryRoot + $Model + "\\Driver Cab")
						}
						else
						{
							# Remove previous driver cab revisions
							Get-ChildItem -Path ($DriverRepositoryRoot + $Model + "\\Driver Cab\\") | Remove-Item
						}
						
						# Download SoftPaq Driver File
						$ProgressListBox.Items.Add("MDT: Softpaq Driver Download Location Set To: $($DriverRepositoryRoot + $Model + '\\Driver Cab\\' + $HPSoftPaqFileName)")
						$ProgressListBox.Items.Add("MDT: Downloading Softpaq From: $HPSoftPaqURL")
						Start-Job -Name "SoftPaqDownload" -ScriptBlock $DriverDownloadJob -ArgumentList ($DriverRepositoryRoot, $Model, $HPSoftPaqFileName, $HPSoftPaqURL)
						#Start-BitsTransfer -DisplayName "$Model Driver Download" -Source $HPSoftPaqURL -Destination $($DriverRepositoryRoot + $Model + "\\Driver Cab\\" + $HPSoftPaqFileName) -RetryTimeout 90 -RetryInterval 180
						while ((Get-Job -Name "SoftPaqDownload").State -eq "Running")
						{
							$ProgressListBox.Items.Add("MDT: Waiting For $HPSoftPaqFileName To Finish Downloading.. Next Check In 60 Seconds")
							UpdateLogWindow
							sleep -Seconds 60
						}
						Get-Job | Receive-Job
						#Remove-Job -Name "$Model MDT Import"
						$ProgressListBox.Items.Add("MDT: SoftPaq Revision: $DriverRevision")
						
						# Extract Drivers From SoftPaq
						if ((Test-Path -Path $DriverExtractDest) -eq $false)
						{
							New-Item -Type dir -Path $DriverExtractDest
							$ProgressListBox.Items.Add("MDT: Running SoftPaq: $($DriverRepositoryRoot + $Model + "\\Driver Cab\\" + $HPSoftPaqFileName)")
							$ProgressListBox.Items.Add("MDT: Driver Extracting To: $DriverExtractDest")
							$SoftPaqSilentSwitches = "-PDF -F" + $env:TEMP + "\\" + $Model + " -S -E"
							Start-Process -FilePath $($DriverRepositoryRoot + $Model + "\\Driver Cab\\" + $HPSoftPaqFileName) -ArgumentList $SoftPaqSilentSwitches -Verb RunAs
						}
						else
						{
							$ProgressListBox.Items.Add("Skipping $HPSoftPaqFileName.. Drivers already extracted...")
						}
						
						$SoftPaqProcess = $HPSoftPaqFileName.TrimEnd(".exe")
						
						$ProgressListBox.Items.Add(" ")
						$ProgressListBox.Items.Add("==================== MDT Driver EXTRACT ====================")
						$ProgressListBox.Items.Add(" ")
						
						# Wait for HP SoftPaq Process To Finish
						While (Get-Process -Name $SoftPaqProcess)
						{
							$ProgressListBox.Items.Add("MDT: Waiting For Extract Process To Complete..  Next Check In 30 Seconds")
							UpdateLogWindow
							sleep -Seconds 30
						}
						
						# Move Extracted Drivers
						$ProgressListBox.Items.Add("MDT: Moving Extracted Drivers...")
						UpdateLogWindow
						
						Get-ChildItem -Path $env:TEMP\\$Model -Recurse | Move-Item -Destination $DriverExtractDest
						
					}
					else
					{
						$ProgressListBox.Items.Add("Skipping $HPSoftPaqFileName.. Driver pack already downloaded...")
					}
					
					
					# =============== MDT Driver Import ====================
					
					$ProgressListBox.Items.Add(" ")
					$ProgressListBox.Items.Add("==================== MDT Driver Import ====================")
					$ProgressListBox.Items.Add(" ")
					$ProgressListBox.Items.Add("Starting $Model MDT Driver Import Process")
					UpdateLogWindow
					
					# Detect First MDT PSDrive
					$ProgressListBox.Items.Add("MDT: Detecting MDT PSDrive")
					If (!$PSDriveName) { $PSDriveName = (Get-MDTPersistentDrive)\[0\].name }
					
					# Detect First MDT Deployment Share
					$ProgressListBox.Items.Add("MDT: Detecting MDT Deployment Share")
					If (!$DeploymentShare) { $DeploymentShare = (Get-MDTPersistentDrive)\[0\].path }
					
					$MDTDriverPath = $PSDriveName + ':\\Out-of-Box Drivers'
					#$ProgressListBox.Items.Add("DEBUG: MDTDriverPath = $MDTDriverPath")
					$MDTSelectionProfilePath = $PSDriveName + ':\\Selection Profiles'
					#$ProgressListBox.Items.Add("DEBUG: MDTSelectionProfilePath = $MDTSelectionProfilePath")
					
					# Connect to Deployment Share
					$ProgressListBox.Items.Add("MDT: Connecting to MDT Share")
					If (!(Get-PSDrive -Name $PSDriveName -ErrorAction SilentlyContinue))
					{
						New-PSDrive -Name $PSDriveName -PSProvider MDTProvider -Root $DeploymentShare
					}
					
					$DSDriverPath = $PSDriveName + ':\\Out-of-Box Drivers'
					$DSSelectionProfilePath = $PSDriveName + ':\\Selection Profiles'
					
					# Connect to Deployment Share
					If ((Get-PSDrive -Name $PSDriveName -ErrorAction SilentlyContinue) -eq $false)
					{
						New-PSDrive -Name $PSDriveName -PSProvider MDTProvider -Root $DeploymentShare
					}
					
					# =============== MDT Driver Import ====================
					
					$Make = "HP"
					$OperatingSystemDir = ($OperatingSystem + " " + $Architecture)
					
					if ((Test-Path $MDTDriverPath\\$OperatingSystemDir) -eq $false)
					{
						New-Item -path $MDTDriverPath -enable "True" -Name $OperatingSystemDir -ItemType "folder"
					}
					
					if ((Test-Path $MDTSelectionProfilePath"\\Drivers - "$OperatingSystemDir) -eq $false)
					{
						New-Item -path $MDTSelectionProfilePath -enable "True" -Name "Drivers - $OperatingSystemDir" -Definition "<SelectionProfile><Include path=\`"Out-of-Box Drivers\\$OS\`" /></SelectionProfile>" -ReadOnly "False" -Verbose
					}
					if ((Test-Path $MDTDriverPath\\$OperatingSystemDir\\$Make) -eq $false)
					{
						New-Item -path $MDTDriverPath\\$OperatingSystemDir -enable "True" -Name $Make -ItemType "folder"
					}
					if ((Test-Path $MDTDriverPath\\$OperatingSystemDir\\$Make\\$Model) -eq $false)
					{
						New-Item -path $MDTDriverPath\\$OperatingSystemDir\\$Make -enable "True" -Name $Model -ItemType "folder"
					}
					if ((Test-Path $MDTDriverPath\\$OperatingSystemDir\\$Make\\$Model\\$DriverRevision) -eq $false)
					{
						New-Item -path $MDTDriverPath\\$OperatingSystemDir\\$Make\\$Model -enable "True" -Name $DriverRevision -ItemType "folder"
						$ProgressListBox.Items.Add("MDT: Importing MDT driver pack for $Make $Model - Revision $DriverRevision")
						$ProgressListBox.Items.Add("MDT: MDT Driver Path = $MDTDriverPath\\$OperatingSystemDir\\$Make\\$Model\\$DriverRevision")
						Import-MDTDriver -path "$MDTDriverPath\\$OperatingSystemDir\\$Make\\$Model\\$DriverRevision" -SourcePath "$DriverExtractDest"
					}
					else
					{
						$ProgressListBox.Items.Add("MDT driver pack already exists.. Skipping..")
					}
				}
			}
			$ProgressBar.Increment(1)
			$ModelProgressOverlay.Increment(1)
			$RemainingModels--
			UpdateLogWindow
		}
		$ProgressBar.Increment(1)
		$ModelProgressOverlay.Increment(1)
		$ProgressListBox.Items.Add(" ")
		$ProgressListBox.Items.Add("======== Finished Processing ======== ")
		$ProgressListBox.Items.Add(" ")
		UpdateLogWindow
	}
	#Output Log File
	$ProgressListBox.Items | Out-File -FilePath $LogFile -Append
}

$ConnectSCCMButton\_Click = {
	
	$SiteServer = \[string\]$SiteServerInput.Text
	$ProgressListBox.ForeColor = "Black"
	$ProgressListBox.Items.Clear()
	$ProgressListBox.Items.Add("======== Validating SCCM Server Details ======== ")
	$ProgressListBox.Items.Add(" ")
	If ((Test-WSMan -ComputerName $SiteServer).wsmid -ne $null)
	{
		Clear-Host
		$ProgressListBox.Items.Add("Connected To Site Server: $SiteServer ")
		$ProgressListBox.Items.Add(" ")
		$ProgressListBox.ForeColor = "Black"
		$ProgressListBox.Items.Add("======== Checking SCCM Prerequisites ======== ")
		$ProgressListBox.Items.Add(" ")
		
		# Import SCCM PowerShell Module
		$ModuleName = (get-item $env:SMS\_ADMIN\_UI\_PATH).parent.FullName + "\\ConfigurationManager.psd1"
		If ($ModuleName -ne $null)
		{
			$ProgressListBox.Items.Add("Loading SCCM PowerShell Module")
			Import-Module $ModuleName
			$ProgressListBox.Items.Add(" ")
			$ProgressListBox.Items.Add("======== Connecting to SCCM Server ======== ")
			$ProgressListBox.Items.Add(" ")
			$ProgressListBox.Items.Add("Querying Site Code From $SiteServer")
			QuerySiteCode ($SiteServer)
			$SiteCode = $SiteCodeLabel.Text
			$ProgressListBox.Items.Add("$SiteCodeReturned")
			#$SiteCodeText.Text = $SiteCode
			# Process if site code is valid
			if ($SiteCode -ne $null)
			{
				# Add model to ArrayList if not present
				if ($HPModels -ne $null)
				{
					foreach ($Model in $HPModels)
					{
						if ($Model -notin $HPProducts)
						{
							$HPProducts.Add($Model.Model) | Out-Null
							$ProductListBox.Items.Add($Model)
						}
					}
					$StartDownloadButton.Enabled = $true
				}
			}
		}
		else
		{
			$ProgressListBox.ForeColor = "Red"
			$ProgressListBox.Items.Add("Error: SCCM PowerShell Module Not Found")
		}
	}
	else
	{
		$ProgressListBox.ForeColor = "Red"
		$ProgressListBox.Items.Add("Error: SCCM Server Specified Not Found - $($SiteServerInput.Text)")
	}
	
	
	#Output Log File
	$ProgressListBox.Items | Out-File -FilePath $env:TEMP\\DeployEverythingHPTool.txt -Append
}

$MDTBrowseButton\_Click = {
	
	$ProductListBox.Items.Clear()
	$OpenMDTFileDialog.Filter = "All CSV Files (\*.CSV) | \*.CSV"
	$OpenMDTFileDialog.ShowDialog()
	$MDTPathLabel.Text = $OpenMDTFileDialog.FileName
	If ($MDTPathLabel.Text -gt $null)
	{
		$ConnectSCCMButton.Enabled = $true
		$PlatformComboBox.Text = "MDT"
		$PlatformComboBox.Enabled = $false
		$DownloadComboBox.Text = "Drivers"
		$DownloadComboBox.Enabled = $false
		$PackagePathTextBox.Enabled = $false
		$SiteServerInput.Enabled = $false
	}
}


$PlatformComboBox\_SelectedValueChanged = {
	
	If (($PlatformComboBox.SelectedItem) -eq "MDT")
	{
		$DownloadComboBox.Text = "Drivers"
		$DownloadComboBox.Enabled = $false
		$PackagePathTextBox.Enabled = $false
		$SiteCodeText.Enabled = $false
		$SiteServerInput.Enabled = $false
		$ConnectSCCMButton.Enabled = $false
	}
	If (($PlatformComboBox.SelectedItem) -ne "MDT")
	{
		$DownloadComboBox.Enabled = $true
		$PackagePathTextBox.Enabled = $true
		$SiteCodeText.Enabled = $true
		$SiteServerInput.Enabled = $true
		$ConnectSCCMButton.Enabled = $true
	}
}

$ClearSelectionButton\_Click = {
	#Reset's Windows Form
	$ProgressListBox.ForeColor = "Black"
	$ProductListBox.Items.Clear()
	$ProgressListBox.Items.Clear()
	$SiteServerInput.Text = $null
	$SiteServerInput.Enabled = $true
	$SiteCodeText = $null
	$PlatformComboBox.SelectedItem = $null
	$PlatformComboBox.Enabled = $true
	$DownloadComboBox.SelectedItem = $null
	$DownloadComboBox.Enabled = $true
	$OSComboBox.SelectedItem = $null
	$OSComboBox.Enabled = $true
	$ArchitectureComboxBox.SelectedItem = $null
	$ArchitectureComboxBox.Enabled = $true
	$RepositoryTextBox.Text = $null
	$PackagePathTextBox.Text = $null
	$PackagePathTextBox.Enabled = $true
	$StartDownloadButton.Enabled = $false
	$MDTPathLabel.Text = $null
	
}

$AddToListlButton\_Click = {
	$ProductListBox.Items.Add($HPModelListComboBox.Text)
}



$OSComboBox\_SelectedIndexChanged = {
	UpdateModeList
}

$ArchitectureComboxBox\_SelectedIndexChanged = {
	UpdateModeList
}

$button1\_Click = {
	$ProductListBox.Items | Out-File C:\\Test.txt -Append
}



$DeployEverythingcomLink\_LinkClicked = \[System.Windows.Forms.LinkLabelLinkClickedEventHandler\]{
	Start-Process -FilePath "http://www.deployeverything.com"
}

	# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------

$Form\_StateCorrection\_Load=
{
	#Correct the initial state of the form to prevent the .Net maximized form issue
	$MainForm.WindowState = $InitialFormWindowState
}

$Form\_StoreValues\_Closing=
{
	#Store the control values
	$script:MainForm\_SiteCodeText = $SiteCodeText.Text
	$script:MainForm\_SiteServerInput = $SiteServerInput.Text
	$script:MainForm\_ProgressListBox = $ProgressListBox.SelectedItems
	$script:MainForm\_ProductListBox = $ProductListBox.SelectedItems
	$script:MainForm\_ArchitectureComboxBox = $ArchitectureComboxBox.Text
	$script:MainForm\_ArchitectureComboxBox\_SelectedItem = $ArchitectureComboxBox.SelectedItem
	$script:MainForm\_DownloadComboBox = $DownloadComboBox.Text
	$script:MainForm\_DownloadComboBox\_SelectedItem = $DownloadComboBox.SelectedItem
	$script:MainForm\_PlatformComboBox = $PlatformComboBox.Text
	$script:MainForm\_PlatformComboBox\_SelectedItem = $PlatformComboBox.SelectedItem
	$script:MainForm\_PackagePathTextBox = $PackagePathTextBox.Text
	$script:MainForm\_RepositoryTextBox = $RepositoryTextBox.Text
	$script:MainForm\_OSComboBox = $OSComboBox.Text
	$script:MainForm\_OSComboBox\_SelectedItem = $OSComboBox.SelectedItem
}


$Form\_Cleanup\_FormClosed=
{
	#Remove all event handlers from the controls
	try
	{
		$DeployEverythingcomLink.remove\_LinkClicked($DeployEverythingcomLink\_LinkClicked)
		$ConnectSCCMButton.remove\_Click($ConnectSCCMButton\_Click)
		$ClearSelectionButton.remove\_Click($ClearSelectionButton\_Click)
		$StartDownloadButton.remove\_Click($StartDownloadButton\_Click)
		$ArchitectureComboxBox.remove\_SelectedIndexChanged($ArchitectureComboxBox\_SelectedIndexChanged)
		$PlatformComboBox.remove\_SelectedValueChanged($PlatformComboBox\_SelectedValueChanged)
		$OSComboBox.remove\_SelectedIndexChanged($OSComboBox\_SelectedIndexChanged)
		$MainForm.remove\_Load($MainForm\_Load)
		$MainForm.remove\_Load($Form\_StateCorrection\_Load)
		$MainForm.remove\_Closing($Form\_StoreValues\_Closing)
		$MainForm.remove\_FormClosed($Form\_Cleanup\_FormClosed)
	}
	catch { Out-Null <# Prevent PSScriptAnalyzer warning #> }
}
#endregion Generated Events

#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
$MainForm.SuspendLayout()
$SCCMDellTabControl.SuspendLayout()
$SCCMTabPage1.SuspendLayout()
$DownloadGroupBox.SuspendLayout()
#
# MainForm
#
$MainForm.Controls.Add($DeployEverythingcomLink)
$MainForm.Controls.Add($SCCMDellTabControl)
$MainForm.Controls.Add($labelPleaseNoteThisToolIs)
$MainForm.Controls.Add($ClearSelectionButton)
$MainForm.Controls.Add($ModelProgressOverlay)
$MainForm.Controls.Add($ProgressBar)
$MainForm.Controls.Add($ProgressListBox)
$MainForm.Controls.Add($AboutToolLabel)
$MainForm.Controls.Add($AutomationLabel)
$MainForm.Controls.Add($picturebox1)
$MainForm.Controls.Add($ProductListBox)
$MainForm.Controls.Add($StartDownloadButton)
$MainForm.Controls.Add($DownloadGroupBox)
$MainForm.Controls.Add($ModelListBox)
$MainForm.Controls.Add($ModelProgressLabel)
$MainForm.Controls.Add($LoggingLabel)
$MainForm.AutoScaleDimensions = '9, 17'
$MainForm.AutoScaleMode = 'Font'
$MainForm.BackColor = 'White'
$MainForm.ClientSize = '981, 653'
$MainForm.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$MainForm.FormBorderStyle = 'FixedSingle'
$MainForm.Margin = '5, 4, 5, 4'
$MainForm.MaximizeBox = $False
$MainForm.MinimizeBox = $False
$MainForm.Name = 'MainForm'
$MainForm.SizeGripStyle = 'Hide'
$MainForm.StartPosition = 'CenterScreen'
$MainForm.Text = 'DeployEverything.com - HP Driver Download Automation Tool v1.0'
$MainForm.add\_Load($MainForm\_Load)
#
# DeployEverythingcomLink
#
$DeployEverythingcomLink.ActiveLinkColor = 'SteelBlue'
$DeployEverythingcomLink.Font = 'Microsoft Sans Serif, 10pt, style=Bold'
$DeployEverythingcomLink.LinkColor = 'DarkGreen'
$DeployEverythingcomLink.Location = '766, 624'
$DeployEverythingcomLink.Margin = '4, 0, 4, 0'
$DeployEverythingcomLink.Name = 'DeployEverythingcomLink'
$DeployEverythingcomLink.Size = '202, 30'
$DeployEverythingcomLink.TabIndex = 37
$DeployEverythingcomLink.TabStop = $True
$DeployEverythingcomLink.Text = 'DeployEverything.com'
$DeployEverythingcomLink.add\_LinkClicked($DeployEverythingcomLink\_LinkClicked)
#
# SCCMDellTabControl
#
$SCCMDellTabControl.Controls.Add($SCCMTabPage1)
$SCCMDellTabControl.Location = '28, 101'
$SCCMDellTabControl.Margin = '4, 3, 4, 3'
$SCCMDellTabControl.Name = 'SCCMDellTabControl'
$SCCMDellTabControl.SelectedIndex = 0
$SCCMDellTabControl.Size = '934, 91'
$SCCMDellTabControl.TabIndex = 0
#
# SCCMTabPage1
#
$SCCMTabPage1.Controls.Add($SiteCodeLabel)
$SCCMTabPage1.Controls.Add($SiteCodeText)
$SCCMTabPage1.Controls.Add($SiteServerLabel)
$SCCMTabPage1.Controls.Add($SiteServerInput)
$SCCMTabPage1.Controls.Add($ConnectSCCMButton)
$SCCMTabPage1.BackColor = 'WhiteSmoke'
$SCCMTabPage1.ForeColor = 'SteelBlue'
$SCCMTabPage1.Location = '4, 26'
$SCCMTabPage1.Margin = '4, 3, 4, 3'
$SCCMTabPage1.Name = 'SCCMTabPage1'
$SCCMTabPage1.Padding = '4, 3, 4, 3'
$SCCMTabPage1.Size = '926, 61'
$SCCMTabPage1.TabIndex = 0
$SCCMTabPage1.Text = 'SCCM Site Details'
#
# SiteCodeLabel
#
$SiteCodeLabel.AutoSize = $True
$SiteCodeLabel.BackColor = 'WhiteSmoke'
$SiteCodeLabel.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$SiteCodeLabel.Location = '266, 27'
$SiteCodeLabel.Margin = '4, 0, 4, 0'
$SiteCodeLabel.Name = 'SiteCodeLabel'
$SiteCodeLabel.Size = '78, 17'
$SiteCodeLabel.TabIndex = 11
$SiteCodeLabel.Text = 'Site Code'
#
# SiteCodeText
#
$SiteCodeText.CharacterCasing = 'Upper'
$SiteCodeText.Enabled = $False
$SiteCodeText.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$SiteCodeText.ForeColor = 'SteelBlue'
$SiteCodeText.Location = '352, 24'
$SiteCodeText.Margin = '4, 3, 4, 3'
$SiteCodeText.Name = 'SiteCodeText'
$SiteCodeText.Size = '64, 23'
$SiteCodeText.TabIndex = 10
#
# SiteServerLabel
#
$SiteServerLabel.AutoSize = $True
$SiteServerLabel.BackColor = 'WhiteSmoke'
$SiteServerLabel.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$SiteServerLabel.Location = '8, 27'
$SiteServerLabel.Margin = '4, 0, 4, 0'
$SiteServerLabel.Name = 'SiteServerLabel'
$SiteServerLabel.Size = '89, 17'
$SiteServerLabel.TabIndex = 9
$SiteServerLabel.Text = 'Site Server'
#
# SiteServerInput
#
$SiteServerInput.CharacterCasing = 'Upper'
$SiteServerInput.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$SiteServerInput.ForeColor = 'SteelBlue'
$SiteServerInput.Location = '105, 24'
$SiteServerInput.Margin = '4, 3, 4, 3'
$SiteServerInput.Name = 'SiteServerInput'
$SiteServerInput.Size = '150, 23'
$SiteServerInput.TabIndex = 8
#
# ConnectSCCMButton
#
$ConnectSCCMButton.BackColor = 'SteelBlue'
$ConnectSCCMButton.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$ConnectSCCMButton.ForeColor = 'White'
$ConnectSCCMButton.Location = '438, 24'
$ConnectSCCMButton.Margin = '4, 3, 4, 3'
$ConnectSCCMButton.Name = 'ConnectSCCMButton'
$ConnectSCCMButton.Size = '157, 23'
$ConnectSCCMButton.TabIndex = 5
$ConnectSCCMButton.Text = 'Connect To SCCM'
$ConnectSCCMButton.UseVisualStyleBackColor = $False
$ConnectSCCMButton.add\_Click($ConnectSCCMButton\_Click)
#
# labelPleaseNoteThisToolIs
#
$labelPleaseNoteThisToolIs.AutoSize = $True
$labelPleaseNoteThisToolIs.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$labelPleaseNoteThisToolIs.Location = '28, 626'
$labelPleaseNoteThisToolIs.Margin = '4, 0, 4, 0'
$labelPleaseNoteThisToolIs.Name = 'labelPleaseNoteThisToolIs'
$labelPleaseNoteThisToolIs.Size = '382, 17'
$labelPleaseNoteThisToolIs.TabIndex = 36
$labelPleaseNoteThisToolIs.Text = 'Please Note: This tool is not an official HP Product '
#
# ClearSelectionButton
#
$ClearSelectionButton.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$ClearSelectionButton.Location = '28, 369'
$ClearSelectionButton.Margin = '4, 3, 4, 3'
$ClearSelectionButton.Name = 'ClearSelectionButton'
$ClearSelectionButton.Size = '276, 23'
$ClearSelectionButton.TabIndex = 35
$ClearSelectionButton.Text = 'Clear Selection'
$ClearSelectionButton.UseVisualStyleBackColor = $True
$ClearSelectionButton.add\_Click($ClearSelectionButton\_Click)
#
# ModelProgressOverlay
#
$ModelProgressOverlay.Location = '28, 594'
$ModelProgressOverlay.Margin = '4, 3, 4, 3'
$ModelProgressOverlay.Name = 'ModelProgressOverlay'
$ModelProgressOverlay.Size = '934, 23'
$ModelProgressOverlay.TabIndex = 30
#
# ProgressBar
#
$ProgressBar.Location = '28, 594'
$ProgressBar.Margin = '4, 3, 4, 3'
$ProgressBar.Name = 'ProgressBar'
$ProgressBar.Size = '934, 23'
$ProgressBar.Style = 'Continuous'
$ProgressBar.TabIndex = 28
#
# ProgressListBox
#
$ProgressListBox.BackColor = 'WhiteSmoke'
$ProgressListBox.Font = 'Microsoft Sans Serif, 8.25pt'
$ProgressListBox.FormattingEnabled = $True
$ProgressListBox.ItemHeight = 17
$ProgressListBox.Location = '28, 422'
$ProgressListBox.Margin = '4, 3, 4, 3'
$ProgressListBox.Name = 'ProgressListBox'
$ProgressListBox.ScrollAlwaysVisible = $True
$ProgressListBox.Size = '934, 140'
$ProgressListBox.TabIndex = 27
#
# AboutToolLabel
#
$AboutToolLabel.AutoSize = $True
$AboutToolLabel.Font = 'Microsoft Sans Serif, 10pt'
$AboutToolLabel.Location = '165, 61'
$AboutToolLabel.Margin = '4, 0, 4, 0'
$AboutToolLabel.Name = 'AboutToolLabel'
$AboutToolLabel.Size = '707, 20'
$AboutToolLabel.TabIndex = 26
$AboutToolLabel.Text = ' Automates the process of downloading, extracting and importing drivers into SCCM and MDT'
#
# AutomationLabel
#
$AutomationLabel.AutoSize = $True
$AutomationLabel.Font = 'Microsoft Sans Serif, 18pt, style=Bold'
$AutomationLabel.ForeColor = 'SteelBlue'
$AutomationLabel.Location = '165, 25'
$AutomationLabel.Margin = '4, 0, 4, 0'
$AutomationLabel.Name = 'AutomationLabel'
$AutomationLabel.Size = '674, 36'
$AutomationLabel.TabIndex = 25
$AutomationLabel.Text = 'DeployEverything - HP Driver Automation Tool'
#
# picturebox1
#
#region Binary Data
$picturebox1.Image = \[System.Convert\]::FromBase64String(' /9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAICAgICAQICAgIDAgIDAwYEAwMDAwcFBQQGCAcJCAgH CAgJCg0LCQoMCggICw8LDA0ODg8OCQsQERAOEQ0ODg7/2wBDAQIDAwMDAwcEBAcOCQgJDg4ODg4O Dg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg7/wAARCABQAFADASIA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3 ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3 uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9efip 8XG8ParJ4d0GVBqSqPtVycHycjIUD+9j8q+LfHPx58HeEr5W8d+PLfT7yUb1iurlpZiPXy1DNj3x ivJ/ix8VLvRPh3438cMRPfxxy3Maucgyu2Ez7bnXj0r8V9X1bUte8T3msaxey6jqd3KZbm4nbc8j Huf8OgHFAH7d/wDDWvwL/wCilWv/AIB3f/xqj/hrX4F/9FKtf/AO7/8AjVfhoFLPxVlLfOOKAP3D /wCGtPgZ/wBFJtf/AACu/wD41Sf8NafAz/opVr/4B3f/AMar8RRa8UG2+XpQB+3X/DWvwL/6KVa/ +Ad3/wDGqP8AhrX4F/8ARSrX/wAA7v8A+NV+HrwYFVipUHIoA/oQ8DfHnwd4tvmbwJ48t9QvIhva K1uWimA9fLYK2PfGK+0vhX8XG8Q6rH4d16VDqTKfstyMDzsDJUj+9j86/ks0nV9S0HxFZaxo97Lp 2qWkoltrmB9rxsO4/kR0I4NftR8Jfirda78OvBPjlSIL+RIriRUOAJY32vj2LI3HpQB8xfGjWzdf syeMbffnfBGMZ/6bx1+cqqWcCvpDWfH0Hir9nPW0MwXUBbxrcwk8hhKmSPY4rE/Z9+Bnib4+fHm0 8IaARZWaKJ9W1ORMx2UAOCx9WPRV7n6GgDxqGAswAGTXXt4S8Q22lC+udB1G3ssZ+0S2Uix49dxG K/bvUPFf7Jv7C+kWeg6P4Zj8XfE5YFeR1ijn1Ikjh5JmGLcHqFXHHY9a9r/ZZ/a+m/aQ8feMNHl8 GR+GLXSLGK4jc3nnNMJHKbWGABjFOxNz+c9bMlRgUNZkJ0r6i+JV/p/hz/go18R9Ym0W31bT7Lxt qJ/s6RAI2UXEigAYxxwQMY4Fehn9oPwcoyfhuD+MH/xFCSBt9j4LmtSARismaDAORX6BSftG+CIx 8/w1B/78f/E1ny/tM+AUzu+GZ/KD/wCJp2XcV32Pz8ZSrV+i3wS1s2v7MXhG3342RS8Z/wCm8lfP nxn+MPhX4h+CbHS9E8ER6Fdw3Qla9ZY94XBGwbADg55z6VDoXj6Dwp+zjo0YmB1AwyrbQg8ljK/J HoM5pFLU+ZopW86QBiN3BwevzCv2m/YynsPhH/wTB8dfFOO2SbWJkvL5iw5kW2jIhjz1wXBz9a/E q2kze4/z1Ffrr+yL4k0zx1+wv4w+EV/cCK4VLm3dc/MILlCFcD/ZbP4047ilsfnjqWs6t4n8aap4 h16+k1LWtRunub26mbLSyOck/wCA6AYFfp3/AME0rgWnxf8AiYwON2jWw/8AIzV+Z/iDwzrPgv4g 6n4a1+1a01OxmMcqkcMOzqe6kcg+hr7W/Ym+J3g/4c/FLxhJ4u1628PwajpkUdtPdttjZkkLFS3Q HB4z1pLcHseP/GRBN+2H8VZOu7xfqR/8mpK4rTvD0+sSzRwTW1qsShnluZdiDPQd+fwrX8e6/ZeI Pj34317TZTPp2o+IL26tZCpXfHJcO6Ng8jKkHn1rlGvpYo2MT7M9RtBB/A1z1vbeyfsrc3S+xyYr 619Wl9Vt7S2nNe1/O2ptXHw41CQYXWdGP/b6f/ia5PXPh3qunaBdag+o6XcxQJueOC83OR7AgZpL jW7+MZWVP+/Kf4Vzep6/qVzp8ttLMhhcYYLEqkj6gV4sHnXOudQt11ex8hRXGHtY+1dHlur2Ur26 213scHdKM1gSSsJUBJIXIGT0+Y1v3LZNclcSYvMe/wDU19CfeFOxkzqSj/PWvZfh34/1/wCHHxJs vEvhy58m7hO2WJs+XcRn7yOPQ/pXh2mvu1mMe9dqpKuKAP1GT4l/AL4/eHLODx2sHhzxJHHtWS7n FvLEe4jnPysuezflT7b9mX4STnzbf4izLC3Kbbm3cY+uea/MaGbB61pRvCcExoT7qKq/cjltsz9Q Iv2YPhSQP+Lkzg/9dbf/ABqx/wAMsfCh1wfidP8A9/Lf/wCKr8xRJBgfuU/75FDSQFP9TH/3yKLr sOz7n6Zy/sl/CSQc/FC4H/bS3/8Aiqyp/wBkD4QODn4o3X/fy3/+Kr805mhK58pP++RWTMYyD8i/ 98ii67BZ9z6z/aC+BHgD4XfDaw1nwz4+Ou6jPeCE6fM0RdkIJLrsOcDAzn1r4WvJMaiw9/611BAy SFA+gri9RfGsSD3/AK0mNGt4r8P6j8Pvjr4l8I6zC8GpaDrFxp93G4IIeGVoz+B25B9K20lSWNZI 2DIRkEV+6f8AwUK/4J7a58WfG178a/gnZxXPjWaIf8JB4f3rGdTKLtWaJjgebtABBI3YHOev4D+J PC/jz4e+I5tG8XeG9Z8I6nExWS01bT5LZwR7OBke44NIZ1QchsirCXBGK8t/tm//AOfhqP7Zv/8A n4agD1v7XxSG6O2vJv7a1D/n4aj+2tQ/5+GoA9RefIquzlhzXmv9s3//AD8NR/bN/wD8/DUAeiSS pFA0kjBVXkk1ieE/D+o/EH46eGvCOjQvPqevaxb6faRoMkvNKsY/Absk+lVvDfhfx58QvEUGjeEf DWs+LtSlYLHaaTp8ly5J9kBwPc8Cv34/4J6/8E9tc+E3jay+Nfxss4rbxrDEf+Ef8P71kOmF12tN KwyPN2kgAE7cnnPQA//Z')
#endregion
$picturebox1.Location = '77, 12'
$picturebox1.Margin = '4, 3, 4, 3'
$picturebox1.Name = 'picturebox1'
$picturebox1.Size = '70, 70'
$picturebox1.SizeMode = 'StretchImage'
$picturebox1.TabIndex = 24
$picturebox1.TabStop = $False
#
# ProductListBox
#
$ProductListBox.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$ProductListBox.ForeColor = 'SteelBlue'
$ProductListBox.FormattingEnabled = $True
$ProductListBox.ItemHeight = 17
$ProductListBox.Location = '28, 214'
$ProductListBox.Margin = '4, 3, 4, 3'
$ProductListBox.Name = 'ProductListBox'
$ProductListBox.SelectionMode = 'MultiExtended'
$ProductListBox.Size = '276, 140'
$ProductListBox.Sorted = $True
$ProductListBox.TabIndex = 3
#
# StartDownloadButton
#
$StartDownloadButton.Anchor = 'None'
$StartDownloadButton.BackColor = 'SteelBlue'
$StartDownloadButton.Enabled = $False
$StartDownloadButton.FlatAppearance.BorderSize = 0
$StartDownloadButton.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$StartDownloadButton.ForeColor = 'White'
$StartDownloadButton.Location = '603, 369'
$StartDownloadButton.Margin = '4, 3, 4, 3'
$StartDownloadButton.Name = 'StartDownloadButton'
$StartDownloadButton.Size = '359, 23'
$StartDownloadButton.TabIndex = 0
$StartDownloadButton.Text = 'Start Download and Import Process'
$StartDownloadButton.UseVisualStyleBackColor = $False
$StartDownloadButton.add\_Click($StartDownloadButton\_Click)
#
# DownloadGroupBox
#
$DownloadGroupBox.Controls.Add($ArchitectureComboxBox)
$DownloadGroupBox.Controls.Add($DownloadComboBox)
$DownloadGroupBox.Controls.Add($PlatformComboBox)
$DownloadGroupBox.Controls.Add($PackagePathTextBox)
$DownloadGroupBox.Controls.Add($RepositoryTextBox)
$DownloadGroupBox.Controls.Add($ArchitectureCheckBox)
$DownloadGroupBox.Controls.Add($lSelectDeployLabel)
$DownloadGroupBox.Controls.Add($OSComboBox)
$DownloadGroupBox.Controls.Add($labelDownloadType)
$DownloadGroupBox.Controls.Add($OperatingSysLabel)
$DownloadGroupBox.Controls.Add($RepositoryLabel)
$DownloadGroupBox.Controls.Add($PackagePathLabel)
$DownloadGroupBox.BackColor = 'WhiteSmoke'
$DownloadGroupBox.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$DownloadGroupBox.ForeColor = 'SteelBlue'
$DownloadGroupBox.Location = '312, 198'
$DownloadGroupBox.Margin = '4, 3, 4, 3'
$DownloadGroupBox.Name = 'DownloadGroupBox'
$DownloadGroupBox.Padding = '4, 3, 4, 3'
$DownloadGroupBox.Size = '650, 165'
$DownloadGroupBox.TabIndex = 21
$DownloadGroupBox.TabStop = $False
$DownloadGroupBox.Text = 'Download Selection'
#
# ArchitectureComboxBox
#
$ArchitectureComboxBox.BackColor = 'White'
$ArchitectureComboxBox.DropDownStyle = 'DropDownList'
$ArchitectureComboxBox.FormattingEnabled = $True
\[void\]$ArchitectureComboxBox.Items.Add('64 bit')
\[void\]$ArchitectureComboxBox.Items.Add('32 bit')
$ArchitectureComboxBox.Location = '199, 113'
$ArchitectureComboxBox.Margin = '4, 3, 4, 3'
$ArchitectureComboxBox.Name = 'ArchitectureComboxBox'
$ArchitectureComboxBox.Size = '140, 25'
$ArchitectureComboxBox.TabIndex = 28
$ArchitectureComboxBox.add\_SelectedIndexChanged($ArchitectureComboxBox\_SelectedIndexChanged)
#
# DownloadComboBox
#
$DownloadComboBox.BackColor = 'White'
$DownloadComboBox.DropDownStyle = 'DropDownList'
$DownloadComboBox.Enabled = $False
$DownloadComboBox.FormattingEnabled = $True
\[void\]$DownloadComboBox.Items.Add('Drivers')
$DownloadComboBox.Location = '13, 113'
$DownloadComboBox.Margin = '4, 3, 4, 3'
$DownloadComboBox.Name = 'DownloadComboBox'
$DownloadComboBox.Size = '140, 25'
$DownloadComboBox.TabIndex = 27
#
# PlatformComboBox
#
$PlatformComboBox.BackColor = 'White'
$PlatformComboBox.DropDownStyle = 'DropDownList'
$PlatformComboBox.FormattingEnabled = $True
\[void\]$PlatformComboBox.Items.Add('SCCM')
\[void\]$PlatformComboBox.Items.Add('MDT')
\[void\]$PlatformComboBox.Items.Add('Both')
$PlatformComboBox.Location = '13, 47'
$PlatformComboBox.Margin = '4, 3, 4, 3'
$PlatformComboBox.Name = 'PlatformComboBox'
$PlatformComboBox.Size = '140, 25'
$PlatformComboBox.TabIndex = 26
$PlatformComboBox.add\_SelectedValueChanged($PlatformComboBox\_SelectedValueChanged)
#
# PackagePathTextBox
#
$PackagePathTextBox.CharacterCasing = 'Upper'
$PackagePathTextBox.Font = 'Microsoft Sans Serif, 8.25pt'
$PackagePathTextBox.Location = '377, 113'
$PackagePathTextBox.Margin = '4, 3, 4, 3'
$PackagePathTextBox.Name = 'PackagePathTextBox'
$PackagePathTextBox.Size = '247, 23'
$PackagePathTextBox.TabIndex = 22
$PackagePathTextBox.Text = '\\\\SERVER\\SHARE'
#
# RepositoryTextBox
#
$RepositoryTextBox.CharacterCasing = 'Upper'
$RepositoryTextBox.Font = 'Microsoft Sans Serif, 8.25pt'
$RepositoryTextBox.Location = '377, 46'
$RepositoryTextBox.Margin = '4, 3, 4, 3'
$RepositoryTextBox.Name = 'RepositoryTextBox'
$RepositoryTextBox.Size = '247, 23'
$RepositoryTextBox.TabIndex = 21
$RepositoryTextBox.Text = '\\\\SERVER\\SHARE'
#
# ArchitectureCheckBox
#
$ArchitectureCheckBox.AutoSize = $True
$ArchitectureCheckBox.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$ArchitectureCheckBox.ForeColor = 'Black'
$ArchitectureCheckBox.Location = '199, 94'
$ArchitectureCheckBox.Margin = '4, 0, 4, 0'
$ArchitectureCheckBox.Name = 'ArchitectureCheckBox'
$ArchitectureCheckBox.Size = '96, 17'
$ArchitectureCheckBox.TabIndex = 20
$ArchitectureCheckBox.Text = 'Architecture'
#
# lSelectDeployLabel
#
$lSelectDeployLabel.AutoSize = $True
$lSelectDeployLabel.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$lSelectDeployLabel.ForeColor = 'Black'
$lSelectDeployLabel.Location = '10, 28'
$lSelectDeployLabel.Margin = '4, 0, 4, 0'
$lSelectDeployLabel.Name = 'lSelectDeployLabel'
$lSelectDeployLabel.Size = '158, 17'
$lSelectDeployLabel.TabIndex = 14
$lSelectDeployLabel.Text = 'Deployment Platform'
#
# OSComboBox
#
$OSComboBox.DropDownStyle = 'DropDownList'
$OSComboBox.FormattingEnabled = $True
\[void\]$OSComboBox.Items.Add('Windows 10')
\[void\]$OSComboBox.Items.Add('Windows 8.1')
\[void\]$OSComboBox.Items.Add('Windows 8')
\[void\]$OSComboBox.Items.Add('Windows 7')
$OSComboBox.Location = '199, 47'
$OSComboBox.Margin = '4, 3, 4, 3'
$OSComboBox.Name = 'OSComboBox'
$OSComboBox.Size = '140, 25'
$OSComboBox.TabIndex = 16
$OSComboBox.add\_SelectedIndexChanged($OSComboBox\_SelectedIndexChanged)
#
# labelDownloadType
#
$labelDownloadType.AutoSize = $True
$labelDownloadType.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$labelDownloadType.ForeColor = 'Black'
$labelDownloadType.Location = '10, 94'
$labelDownloadType.Margin = '4, 0, 4, 0'
$labelDownloadType.Name = 'labelDownloadType'
$labelDownloadType.Size = '119, 17'
$labelDownloadType.TabIndex = 13
$labelDownloadType.Text = 'Download Type'
#
# OperatingSysLabel
#
$OperatingSysLabel.AutoSize = $True
$OperatingSysLabel.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$OperatingSysLabel.ForeColor = 'Black'
$OperatingSysLabel.Location = '199, 28'
$OperatingSysLabel.Margin = '4, 0, 4, 0'
$OperatingSysLabel.Name = 'OperatingSysLabel'
$OperatingSysLabel.Size = '137, 17'
$OperatingSysLabel.TabIndex = 17
$OperatingSysLabel.Text = 'Operating System'
#
# RepositoryLabel
#
$RepositoryLabel.AutoSize = $True
$RepositoryLabel.ForeColor = 'Black'
$RepositoryLabel.Location = '377, 28'
$RepositoryLabel.Margin = '4, 0, 4, 0'
$RepositoryLabel.Name = 'RepositoryLabel'
$RepositoryLabel.Size = '124, 17'
$RepositoryLabel.TabIndex = 23
$RepositoryLabel.Text = 'Repository Path'
#
# PackagePathLabel
#
$PackagePathLabel.AutoSize = $True
$PackagePathLabel.ForeColor = 'Black'
$PackagePathLabel.Location = '377, 94'
$PackagePathLabel.Margin = '4, 0, 4, 0'
$PackagePathLabel.Name = 'PackagePathLabel'
$PackagePathLabel.Size = '108, 17'
$PackagePathLabel.TabIndex = 24
$PackagePathLabel.Text = 'Package Path'
#
# ModelListBox
#
$ModelListBox.AutoSize = $True
$ModelListBox.BackColor = 'Transparent'
$ModelListBox.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$ModelListBox.Location = '28, 198'
$ModelListBox.Margin = '4, 0, 4, 0'
$ModelListBox.Name = 'ModelListBox'
$ModelListBox.Size = '82, 17'
$ModelListBox.TabIndex = 4
$ModelListBox.Text = 'Model List'
#
# ModelProgressLabel
#
$ModelProgressLabel.AutoSize = $True
$ModelProgressLabel.BackColor = 'Transparent'
$ModelProgressLabel.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$ModelProgressLabel.Location = '28, 578'
$ModelProgressLabel.Margin = '4, 0, 4, 0'
$ModelProgressLabel.Name = 'ModelProgressLabel'
$ModelProgressLabel.Size = '121, 17'
$ModelProgressLabel.TabIndex = 32
$ModelProgressLabel.Text = 'Model Progress'
#
# LoggingLabel
#
$LoggingLabel.AutoSize = $True
$LoggingLabel.BackColor = 'Transparent'
$LoggingLabel.Font = 'Microsoft Sans Serif, 8.25pt, style=Bold'
$LoggingLabel.Location = '28, 406'
$LoggingLabel.Margin = '4, 0, 4, 0'
$LoggingLabel.Name = 'LoggingLabel'
$LoggingLabel.Size = '129, 17'
$LoggingLabel.TabIndex = 34
$LoggingLabel.Text = 'Job Process Log'
#
# OpenMDTFileDialog
#
$DownloadGroupBox.ResumeLayout()
$SCCMTabPage1.ResumeLayout()
$SCCMDellTabControl.ResumeLayout()
$MainForm.ResumeLayout()
#endregion Generated Form Code

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

#Save the initial state of the form
$InitialFormWindowState = $MainForm.WindowState
#Init the OnLoad event to correct the initial state of the form
$MainForm.add\_Load($Form\_StateCorrection\_Load)
#Clean up the control events
$MainForm.add\_FormClosed($Form\_Cleanup\_FormClosed)
#Store the control values when form is closing
$MainForm.add\_Closing($Form\_StoreValues\_Closing)
#Show the Form
return $MainForm.ShowDialog()

} #endregion Source: MainForm.psf

#region Source: Globals.ps1 #——————————————– # Declare Global Variables and Functions here #——————————————–

$ErrorActionPreference = 'SilentlyContinue'
#$WarningPreference = 'SilentlyContinue'

# Define HP Download Sources
$HPXMLCabinetSource = "http://ftp.hp.com/pub/caps-softpaq/cmit/HPClientDriverPackCatalog.cab"

# Define HP Cabinet/XL Names and Paths
$HPCabFile = \[string\]($HPXMLCabinetSource | Split-Path -Leaf)
$HPXMLFile = $HPCabFile.Trim(".cab")
$HPXMLFile = $HPXMLFile + ".xml"

# ArrayList to store the Dell models in
$HPProducts = New-Object -TypeName System.Collections.ArrayList

# MDT PS Commandlets
$MDTPSCommandlets = "C:\\Program Files\\Microsoft Deployment Toolkit\\bin\\MicrosoftDeploymentToolkit.psd1"

# Log File Location
$LogFile = "$env:TEMP\\DeployEverythingHPLog.txt"

# Query SCCM Site Code
function QuerySiteCode ($SiteServer)
{
	$SiteCodeObjects = Get-WmiObject -Namespace "root\\SMS" -Class SMS\_ProviderLocation -ComputerName $(\[string\]$SiteServer) -ErrorAction Stop
	if ($SiteCodeObjects -gt $null)
	{
		foreach ($SiteCodeObject in $SiteCodeObjects)
		{
			if ($SiteCodeObject.ProviderForLocalSite -eq $true)
			{
				$SiteCode = $SiteCodeObject.SiteCode
				$ProgressListBox.Items.Add("Site Code Found: $($SiteCode)")
				$SiteCodeText.Text = $SiteCode
			}
		}
	}
	else
	{
		$ProgressListBox.ForeColor = "Red"
		$ProgressListBox.Items.Add(" ")
		$ProgressListBox.Items.Add("Error Site Code Not Found: Please check your security rights to the $SiteServer server.")
	}
}

# Find / Refresh HP Models
function UpdateModeList
{
	# Rest Product Listbox
	$ProductListBox.Items.Clear()	

	If ((Test-Path -Path $env:TEMP\\$HPCabFile) -eq $false)
	{
		$ProgressListBox.Items.Add("======== Downloading HP Product List ======== ")
		$ProgressListBox.Items.Add(" ")
		# Download HP Model Cabinet File
		$ProgressListBox.Items.Add("Downloading HP Driver Pack Cabinet File from $HPXMLCabinetSource")
		Start-BitsTransfer -Source $HPXMLCabinetSource -Destination $env:TEMP -RetryInterval 60 -RetryTimeout 180
		# Expand Cabinet File
		$ProgressListBox.Items.Add(" ")
		$ProgressListBox.Items.Add("Expanding HP Driver Pack Cabinet File: $HPXMLFile")
		UpdateLogWindow
		Expand "$env:TEMP\\$HPCabFile" -F:\* "$env:TEMP\\$HPXMLFile"
	}
	
	# Read XML File
	$ProgressListBox.Items.Add("Reading Driver Pack XML File...")
	UpdateLogWindow
	\[xml\]$HPModelXML = Get-Content -Path $env:TEMP\\$HPXMLFile
	# Set XML Object
	$HPModelXML.GetType().FullName
	$HPModelSoftPaqs = $HPModelXML.newdataset.hpclientdriverpackcatalog.softpaqlist.softpaq
	# Find Models Contained Within Downloaded XML
	$HPModels = ($HPModelSoftPaqs).name | Where-Object { ($\_ -like "\*Win\*$(($OSComboBox.Text).split(' ')\[1\])\*$(($ArchitectureComboxBox.Text).Split(' ')\[0\])\*") }
	if ($HPModels -ne $null)
	{
		foreach ($Model in $HPModels)
		{
			$Model = $Model -replace "Win\[^;\]\*", " "

			if ($Model -notin $HPProducts)
			{
				$HPProducts.Add($Model.Model) | Out-Null
				$ProductListBox.Items.Add($Model)
			}
		}
		$StartDownloadButton.Enabled = $true
	}
	$ProductListBox.Sorted
	$ProgressListBox.Items.Add("INFO: Found $(($HPModels).count) HP Model Driver Packs for $($OSComboBox.text) $($ArchitectureComboxBox.text)")
	UpdateLogWindow
}

function UpdateLogWindow
{
	$ProgressListBox.SelectedIndex = $ProgressListBox.Items.Count - 1;
	$ProgressListBox.SelectedIndex = -1;
}

#endregion Source: Globals.ps1

#Start the application Main ($CommandLine)