Quantcast
Channel: Configuration & Scripting
Viewing all articles
Browse latest Browse all 780

Powershell help, Populate ComboBox with ApplicationPool selection

$
0
0
#Imports cmdlets from ServerManager, IIS Web administration, and IIS Administration
Import-Module WebAdministration
Import-Module IISAdministration
Import-Module ServerManager

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()

$WebsiteCreator                  = New-Object system.Windows.Forms.Form$WebsiteCreator.ClientSize       = '453,456'$WebsiteCreator.text             = "Website Creator"$WebsiteCreator.TopMost          = $false$Label1                          = New-Object system.Windows.Forms.Label$Label1.text                     = "Enter Website Name:"$Label1.AutoSize                 = $true$Label1.width                    = 25$Label1.height                   = 10$Label1.location                 = New-Object System.Drawing.Point(40,33)$Label1.Font                     = 'Microsoft Sans Serif,10'$SiteName                        = New-Object system.Windows.Forms.TextBox$SiteName.multiline              = $false$SiteName.text                   = ".sd.gov"$SiteName.width                  = 152$SiteName.height                 = 20$SiteName.location               = New-Object System.Drawing.Point(40,55)$SiteName.Font                   = 'Microsoft Sans Serif,10'$Label2                          = New-Object system.Windows.Forms.Label$Label2.text                     = "Port:"$Label2.AutoSize                 = $true$Label2.width                    = 25$Label2.height                   = 10$Label2.location                 = New-Object System.Drawing.Point(259,33)$Label2.Font                     = 'Microsoft Sans Serif,10'$PortNumber                      = New-Object system.Windows.Forms.TextBox$PortNumber.multiline            = $false$PortNumber.text                 = "80"$PortNumber.width                = 100$PortNumber.height               = 20$PortNumber.location             = New-Object System.Drawing.Point(259,55)$PortNumber.Font                 = 'Microsoft Sans Serif,10'$Binding                         = New-Object system.Windows.Forms.Label$Binding.text                    = "Enter the Binding:"$Binding.AutoSize                = $true$Binding.width                   = 25$Binding.height                  = 10$Binding.location                = New-Object System.Drawing.Point(40,104)$Binding.Font                    = 'Microsoft Sans Serif,10'$Header                          = New-Object system.Windows.Forms.TextBox$Header.multiline                = $false$Header.text                     = ".sd.gov"$Header.width                    = 150$Header.height                   = 20$Header.location                 = New-Object System.Drawing.Point(40,133)$Header.Font                     = 'Microsoft Sans Serif,10'$Label3                          = New-Object system.Windows.Forms.Label$Label3.text                     = "Physical Path:"$Label3.AutoSize                 = $true$Label3.width                    = 25$Label3.height                   = 10$Label3.location                 = New-Object System.Drawing.Point(40,197)$Label3.Font                     = 'Microsoft Sans Serif,10'$BrowseBtn                       = New-Object system.Windows.Forms.Button$BrowseBtn.text                  = "Browse"$BrowseBtn.width                 = 60$BrowseBtn.height                = 30$BrowseBtn.location              = New-Object System.Drawing.Point(40,254)$BrowseBtn.Font                  = 'Microsoft Sans Serif,10'$TextBox1                        = New-Object system.Windows.Forms.TextBox$TextBox1.multiline              = $false$TextBox1.text                   = "\\state.sd.local\"$TextBox1.width                  = 186$TextBox1.height                 = 20$TextBox1.location               = New-Object System.Drawing.Point(40,224)$TextBox1.Font                   = 'Microsoft Sans Serif,10'$CancelBtn                       = New-Object system.Windows.Forms.Button$CancelBtn.text                  = "Close"$CancelBtn.width                 = 60$CancelBtn.height                = 30$CancelBtn.location              = New-Object System.Drawing.Point(307,374)$CancelBtn.Font                  = 'Microsoft Sans Serif,10'$CreateBtn                       = New-Object system.Windows.Forms.Button$CreateBtn.text                  = "Create"$CreateBtn.width                 = 60$CreateBtn.height                = 30$CreateBtn.location              = New-Object System.Drawing.Point(65,374)$CreateBtn.Font                  = 'Microsoft Sans Serif,10'$Label4                          = New-Object system.Windows.Forms.Label$Label4.text                     = "Choose Application Pool:"$Label4.AutoSize                 = $true$Label4.width                    = 25$Label4.height                   = 10$Label4.location                 = New-Object System.Drawing.Point(259,104)$Label4.Font                     = 'Microsoft Sans Serif,10'$AppPoolBox                      = New-Object system.Windows.Forms.ComboBox$AppPoolBox.text                 = "Application Pool"$AppPoolBox.width                = 151$AppPoolBox.height               = 20$AppPoolBox.location             = New-Object System.Drawing.Point(259,133)$AppPoolBox.Font                 = 'Microsoft Sans Serif,10'$WebsiteCreator.controls.AddRange(@($Label1,$SiteName,$Label2,$PortNumber,$Binding,$Header,$Label3,$BrowseBtn,$TextBox1,$CancelBtn,$CreateBtn,$Label4,$AppPoolBox))

[void]$WebsiteCreator.ShowDialog()

I'm so stuck right now.

I'm trying to make my comboBox populate with a current list of application pools that are on the Webserver, but I don't know how...

Could anyone assist?

I'm sorry, I know the script I posted is long, but there it is, the GUI is built, this is the only piece of the puzzle I'm stuck on.

(GUI code written by Poshgui)


Viewing all articles
Browse latest Browse all 780

Trending Articles