########################################################################
# Code Generated By: SAPIEN Technologies, Inc., PrimalForms 2009 v1.1.11.0
# Generated On: 18-4-2011 9:35
# Generated By: Jack van Deur
# Organization: Q-serv (www.q-serv.nl)
########################################################################
#----------------------------------------------
#region Application Functions
#----------------------------------------------
function OnApplicationLoad {
#Note: This function runs before the form is created
#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
#Important: Form controls cannot be accessed in this function
#TODO: Add snapins and custom code to validate the application load
return $true #return true for success or false for failure
}
function OnApplicationExit {
#Note: This function runs after the form is closed
#TODO: Add custom code to clean up and unload snapins when the application exits
$script:ExitCode = 0 #Set the exit code for the Packager
}
#endregion
#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function GenerateForm {
#----------------------------------------------
#region Import Assemblies
#----------------------------------------------
[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("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[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.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
#endregion
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object System.Windows.Forms.Form
$statusbar1 = New-Object System.Windows.Forms.StatusBar
$BtServer = New-Object System.Windows.Forms.Button
$button17 = New-Object System.Windows.Forms.Button
$groupbox1 = New-Object System.Windows.Forms.GroupBox
$tDNSadd = New-Object System.Windows.Forms.TextBox
$DNSrem = New-Object System.Windows.Forms.Button
$DNSedt = New-Object System.Windows.Forms.Button
$DNSadd = New-Object System.Windows.Forms.Button
$listDNS = New-Object System.Windows.Forms.ListBox
$DNSsearchEdt = New-Object System.Windows.Forms.Button
$DNSsearchRem = New-Object System.Windows.Forms.Button
$DNSsearchAdd = New-Object System.Windows.Forms.Button
$tDNSsearchAdd = New-Object System.Windows.Forms.TextBox
$label17 = New-Object System.Windows.Forms.Label
$button16 = New-Object System.Windows.Forms.Button
$button6 = New-Object System.Windows.Forms.Button
$button15 = New-Object System.Windows.Forms.Button
$button5 = New-Object System.Windows.Forms.Button
$ListDNSsearch = New-Object System.Windows.Forms.ListBox
$label8 = New-Object System.Windows.Forms.Label
$tDNSSuf = New-Object System.Windows.Forms.TextBox
$checkbox2 = New-Object System.Windows.Forms.CheckBox
$checkbox1 = New-Object System.Windows.Forms.CheckBox
$label4 = New-Object System.Windows.Forms.Label
$groupbox5 = New-Object System.Windows.Forms.GroupBox
$listbox1 = New-Object System.Windows.Forms.ListBox
$button8 = New-Object System.Windows.Forms.Button
$button9 = New-Object System.Windows.Forms.Button
$btChange = New-Object System.Windows.Forms.Button
$button2 = New-Object System.Windows.Forms.Button
$button1 = New-Object System.Windows.Forms.Button
$groupbox4 = New-Object System.Windows.Forms.GroupBox
$tiID = New-Object System.Windows.Forms.TextBox
$label20 = New-Object System.Windows.Forms.Label
$lMan = New-Object System.Windows.Forms.Label
$tMan = New-Object System.Windows.Forms.TextBox
$CBSpeedDuplex = New-Object System.Windows.Forms.ComboBox
$label13 = New-Object System.Windows.Forms.Label
$label14 = New-Object System.Windows.Forms.Label
$label12 = New-Object System.Windows.Forms.Label
$label11 = New-Object System.Windows.Forms.Label
$label10 = New-Object System.Windows.Forms.Label
$tNIC = New-Object System.Windows.Forms.TextBox
$tDdat = New-Object System.Windows.Forms.TextBox
$label9 = New-Object System.Windows.Forms.Label
$tDver = New-Object System.Windows.Forms.TextBox
$cb1 = New-Object System.Windows.Forms.ComboBox
$tMac = New-Object System.Windows.Forms.TextBox
$tLoc = New-Object System.Windows.Forms.TextBox
$groupbox3 = New-Object System.Windows.Forms.GroupBox
$label19 = New-Object System.Windows.Forms.Label
$label18 = New-Object System.Windows.Forms.Label
$checkDHCP = New-Object System.Windows.Forms.CheckBox
$label3 = New-Object System.Windows.Forms.Label
$label2 = New-Object System.Windows.Forms.Label
$label1 = New-Object System.Windows.Forms.Label
$tsDNS = New-Object System.Windows.Forms.TextBox
$tDefGW = New-Object System.Windows.Forms.TextBox
$tpDNS = New-Object System.Windows.Forms.TextBox
$tSub = New-Object System.Windows.Forms.TextBox
$tIP = New-Object System.Windows.Forms.TextBox
$groupbox2 = New-Object System.Windows.Forms.GroupBox
$rbWins3 = New-Object System.Windows.Forms.RadioButton
$rbWins2 = New-Object System.Windows.Forms.RadioButton
$rbWins1 = New-Object System.Windows.Forms.RadioButton
$checkLMH = New-Object System.Windows.Forms.CheckBox
$label6 = New-Object System.Windows.Forms.Label
$label7 = New-Object System.Windows.Forms.Label
$TWIP1 = New-Object System.Windows.Forms.TextBox
$tWIP2 = New-Object System.Windows.Forms.TextBox
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$FormEvent_Load={
#TODO: Initialize Form Controls here
cls
$cbcol = $null
$cb = $null
start-job -Name job1 -ScriptBlock {Get-WmiObject -Class Win32_NetworkAdapter -Filter "AdapterTypeID=0"}
Start-Job -Name job2 -ScriptBlock {Get-WmiObject -Class Win32_NetworkAdapterConfiguration}
#region NVSPbind
#Getting the current bindingorder for the ms_tcpip (ipv4) protocol
[string]$nvsp = nvspbind /o ms_tcpip
fnvspbind
#removing excessive text to get a clean list
#endregion
$registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $serverName)
$registry = $registry.OpenSubKey("SYSTEM\", $true)
Set-Variable -Name baseKey -value $registry.OpenSubKey("CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}")-Scope script
Set-Variable -Name PCIkey -value $registry.OpenSubKey("CurrentControlSet\Enum") -Scope script
Set-Variable -Name changeKey -value $registry.OpenSubKey("CurrentControlSet\services\Tcpip\Parameters") -Scope script
Set-Variable -Name nbtkey -value $registry.opensubkey("CurrentControlSet\services\NetBT\Parameters") -Scope script
}
#region userfunctions
#-----------------------------------------------------------------
function fNVSPbind {
$nvspb = $nvsp.replace("enabled: ","~")
$nvsp = $nvspb.replace("cleaning up...","~")
$nvspb = $nvsp.split("~")
$nvsp = $nvspb.count
$listbox1.Items.AddRange($nvspb[1..($nvsp - 2)])
$listDNS.items.remove(0..($listDNS.Items.Count))
}
function get-boards {
$cb1.Items.Clear()
$Nicload = Receive-Job job1 -keep
ForEach ($Nic in $nicload)
{
[string]$cb = $Nic.Description
$cb1.Items.Add($cb)
}
}
function enable-static{
$tIP.Enabled = $true
$tSub.Enabled = $true
$tDefGW.Enabled = $true
$listDNS.Enabled = $true
$listdnssearch.Enabled = $true
$TWIP1.enabled = $true
$tWIP2.enabled = $true
}
function disable-static{
$tIP.Enabled = $false
$tSub.Enabled = $false
$tDefGW.Enabled = $fals
$listDNS.Enabled = $false
$ListDNSsearch.Enabled = $false
$TWIP1.enabled = $false
$tWIP2.enabled = $false
$tIP.Text = $null
$tSub.Text = $null
$tdefgw.Text = $null
$tsDNS.Text = $null
$tpDNS.Text = $null
$listdns.Items.Clear()
$tDNSadd.Text = $null
$listdnssearch.Items.Clear()
$tdnssearchadd.Text = $null
$tWIP1.Text = $null
$twIP2.Text = $null
}
function clearstatic {
Set-Location hklm:"\$ippath"
Set-ItemProperty -Path .\. -Name enabledhcp -Value 1
clear-ItemProperty -Path .\. -Name Ipaddress
clear-ItemProperty -Path .\. -Name DefaultGateway
clear-ItemProperty -Path .\. -Name SubnetMask
Clear-ItemProperty -Path .\. -Name NameServer
Set-Location hklm:"\$changekey"
clear-ItemProperty -Path .\. -Name SearchList
Set-ItemProperty -Path .\. -Name RegisterAdapterName -Value 0
Set-ItemProperty -Path .\. -Name RegistrationEnabled -Value 0
Set-Location hklm:"\$nbtkey"
set-itemproperty -Path .\. -name EnableLMHosts -value 0
set-itemproperty -Path interfaces\Tcpip_$id -name NetBiosOptions -value 0
clear-itemproperty -Path interfaces\Tcpip_$id -name Nameserverlist
clear-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" -Name ipaddress
clear-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" -Name DefaultGateway
clear-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" -Name Subnetmask
set-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" -Name enabledhcp -Value(1)
try
{
clear-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" -Name DHCPipaddress
clear-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" -Name DHCPDefaultGateway
clear-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" -Name DHCPSubnetmask
}
catch {}#add error catching
}
function setstatic {
#This function runs after pressing the CHANGE key.
Set-ItemProperty -Path .\. -Name Ipaddress -Value $tIP.text
Set-ItemProperty -path .\. -Name Domain -value $tDNSSuf.text
Set-ItemProperty -Path .\. -Name SubnetMask -Value $tsub.text
Set-ItemProperty -Path .\. -Name DefaultGateway -Value $tDefGW.text
set-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" `
-Name ipaddress -value $tIP.text
set-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" `
-Name DefaultGateway -value $tDefGW.text
set-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" `
-Name Subnetmask -value $tsub.text
set-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" `
-Name enableDHCP -value(0)
set-ItemProperty -ErrorAction silentlycontinue -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" `
-Name dhcpserver -value("255.255.255.255")
#write the nameserverlist to the registry
clear-ItemProperty -Path .\. -Name Nameserver
foreach($item in $listdns.items) {
$DNSservers += $item + ","
}
if ($DNSservers -ne $null)
{
$dnsservers = $dnsservers.trimend(",")
}
Set-ItemProperty -Path .\. -Name Nameserver -Value $dnsservers
#Set the value for full dns registration
if ($checkbox1.Checked -eq $true)
{
Set-ItemProperty -Path .\. -Name RegistrationEnabled -Value 1
}
else
{
Set-ItemProperty -Path .\. -Name RegistrationEnabled -Value 0
}
#set the value for auto adapter registration in DNS
if ($checkbox2.Checked -eq $true)
{
Set-ItemProperty -Path .\. -Name RegisterAdapterName -Value 1
}
else
{
Set-ItemProperty -Path .\. -Name RegisterAdapterName -Value 0
}
#write the searchorderlist to the registry
Set-Location hklm:"\$changekey"
clear-ItemProperty -Path .\. -Name SearchList
foreach ($item in $ListDNSsearch.items){
$strdnssearch += $item + ","
}
if ($strdnssearch -ne $null)
{
$strdnssearch = $strdnssearch.trimend(",")
}
Set-ItemProperty -Path .\. -Name SearchList -Value $strdnssearch
#Write winsserver addresses to the registry
if ($TWIP1.Text -ne $null)
{
[array]$strSetWins = $TWIP1.Text
if ($TWIP2.Text -ne $null)
{
$strSetWins += $tWIP2.text
}
Set-Location hklm:"\$nbtkey"
Set-ItemProperty -Path interfaces\Tcpip_$id -Name NameserverList -Value $strSetWins
}
else
{
Set-ItemProperty -Path interfaces\Tcpip_$id -Name NameserverList -Value $null
}
#set the status for LMhosts lookup
if ($checkLMH.checked -eq $true)
{
set-itemproperty -Path .\. -name EnableLMHosts -value 1
}
else
{
set-itemproperty -Path .\. -name EnableLMHosts -value 0
}
#set the status for the netbios options
if ($rbWins1.checked -eq $true){set-itemproperty -Path interfaces\Tcpip_$id -name NetBiosOptions -value 0}
if ($rbWins2.checked -eq $true){set-itemproperty -Path interfaces\Tcpip_$id -name NetBiosOptions -value 1}
if ($rbWins3.checked -eq $true){set-itemproperty -Path interfaces\Tcpip_$id -name NetBiosOptions -value 2}
}
function refresh {
$ListDNSsearch.Items.clear()
$listDNS.Items.Clear()
$tIP.text = $null
$tSub.text = $null
$tDefGW.text = $null
$TSDNS.text = $null
$TPDNS.text = $null
$TWIP1.text = $null
$tWIP2.text = $null
}
function get-NicSettings {
Set-Variable -scope script -Name NicAdapter -value (Receive-Job job1 -keep)
Set-Variable -scope script -Name NicConfig -value (Receive-Job job2 -keep)
foreach ($Nic in $nicconfig)
{
If ($Nic.Description -eq $cb1.Text)
{
$Tmac.Text = $Nic.MACAddress
[int]$idx = $nic.InterfaceIndex
$tiID.Text = ([Convert]::ToString($idx,16))
if ($Nic.DHCPEnabled -eq "True"){
$checkDHCP.checked = $true
$cb4state = $null
$tIP.Enabled = $false
$tSub.Enabled = $false
$tDefGW.Enabled = $false
$listDNS.Enabled = $false
$ListDNSsearch.Enabled = $false
$TWIP1.Enabled = $false
$tWIP2.Enabled = $false
}
else
{
if ($checkDHCP.Checked -eq $true)
{
$checkDHCP.Checked = $false
enable-static
}
}
#define the subkey for the specified board
[string]$a = $Nic.index #read the index number as string
Set-Variable -Name indexnum -value $a -Scope script
#determine the length of the a variable and add 0 accordingly.
if ($a.Length -eq 1){$subkeyname = "000" + $a}
elseif ($a.length -eq 2){$subKeyname = "00" + $a}
elseif ($a.Length -eq 3){$subkeyname = "0" + $a}
elseif ($a.Length -eq 4){$subkeyname = $a}
#subkey is equal to the index number
#this way no error is thrown when trying to read the properties subkey
ForEach ($adap in $NicAdapter)
{
If ($adap.index -eq $a)
{
$tnic.Text = $adap.NetconnectionID
}
}
$subKey = $baseKey.OpenSubKey("$subKeyName")
Set-Variable -Name ID -value $subKey.GetValue("NetCfgInstanceId") -Scope script
Set-Variable -Name winskey -Value $registry.opensubkey("CurrentControlSet\services\NetBT\Parameters\Interfaces\Tcpip_$ID", $true) -Scope script
$devID = $subKey.GetValue("DeviceInstanceId")
$LocID = $PCIkey.OpenSubKey("$devID")
Set-Variable -Name ipPath -Value $ChangeKey.openSubKey("interfaces\$ID") -Scope script
try
{
enable-static
$tIP.text = $Nic.IPAddress[0]
$tsub.Text = $Nic.IPSubnet[0]
$tdefgw.Text = $Nic.DefaultIPGateway
$TPDNS.text = $Nic.DNSServerSearchOrder[0]
$TSDNS.text = $Nic.DNSServerSearchOrder[1]
$tWIP1.Text = $Nic.WINSPrimaryServer
$tWIP2.text = $Nic.WINSSecondaryServer
if ($Nic.FullDNSRegistrationEnabled -eq "true"){$checkbox1.Checked = $true}
if ($Nic.DomainDNSregistrationEnabled -eq "true"){$checkbox2.Checked = $true}
#Wins settings
if ($Nic.WinsEnableLMHostsLookup -eq "true"){$checkLMH.Checked = $true}
#find out the netbios over tcpip option
if ($Nic.TcpipNetbiosOptions -eq 0){$rbWins1.Checked = $true}
if ($Nic.TcpipNetbiosOptions -eq 1){$rbWins2.Checked = $true}
if ($Nic.TcpipNetbiosOptions -eq 2){$rbWins3.Checked = $true}
}
catch
{
If ($checkDHCP.Checked -eq $true)
{
[System.Windows.Forms.MessageBox]::Show("No IP address information available while DHCP is on. Check your network cabling or your DHCP server!")
}
else
{
try
{
$tIP.text = $ipPath.GetValue("IpAddress")
$tsub.text = $ipPath.GetValue("subnetmask")
$tdefgw.text = $ipPath.GetValue("DefaultGateway")
$dns = $ipPath.GetValue("Nameserver")
[array] $dns = $dns.split(",")
foreach ($ns in $dns)
{
$listDNS.Items.Add($ns)
}
$tpdns.text = $listdns.Items[0]
$tsdns.text = $listdns.items[1]
if ($ippath.getvalue("RegistrationEnabled")-eq 1){$checkbox1.Checked = $true}
if ($ippath.getvalue("RegisterAdapterName")-eq 1){$checkbox2.Checked = $true}
if ($nbtkey.getvalue("EnableLMHosts") -eq 1){$checkLMH.Checked = $true}
$nbtintkey = $nbtkey.opensubkey("interfaces\Tcpip_$id")
$netbtval = $nbtintkey.getvalue("netbiosoptions")
if ($netbtval -eq 0){$rbWins1.Checked = $true}
if ($netbtval -eq 1){$rbWins2.Checked = $true}
if ($netbtval -eq 2){$rbWins3.Checked = $true}
$wins = $nbtintkey.getvalue("Nameserverlist")
$TWIP1.Text = $wins[0]
$tWIP2.Text = $wins[1]
}
catch
{
[System.Windows.Forms.MessageBox]::Show("NO network available. Check your IP configuration,your cabling or connection settings!")
}
}
}
Set-Variable -Name $ipPath -Value $ippath.getvaluenames() -Scope script
$tDNSSuf.Text = $ipPath.Getvalue("Domain")
Try
{
Set-Variable -Name DNSsListitems -value $changekey.getvalue("Searchlist") -Scope script
$DNSsListitems = $DNSsListitems.Split(",")
foreach ($litem in $DNSsListitems)
{
$ListDNSsearch.Items.Add($litem)
}
}
catch
{
#hier nog een een errorafhandeling invoegen
}
If ($ID -eq $Nic.SettingId)
{
# get the value for location information and trim it back to something understandable
try
{
$a = $locID.Getvalue("LocationInformation")
$b = $a.Split("()")[1]
$c = $b.Split(",")
$bus = $c[0]
$Dev = $c[1]
$func = $c[2]
$Locationinfo = "BusNumber " + $bus + "; DeviceID " + $dev + "; Function " + $func
$tLoc.Text = $LocationInfo
}
catch
{
if ($tMan.Text -like "VMware")
{
$tLoc.Text = "Virtual NIC: no locationinfo"
}
}
$componentID = $subKey.GetValue("ComponentID")
Set-Location hklm:"\$subkey"
gci . -rec -ea SilentlyContinue |
% {
if((get-itemproperty -Path $_.PsPath ) -match "full" -and (get-itemproperty -Path $_.PsPath )-match "auto" )
{
$p = $_.PsPath
}
}
Set-Location "$p"
$path = $PWD
Set-Location ..\.
$y = $pwd.ProviderPath.Split("\")
$spdup = $y[($y.Count -1)]
try
{
$SD = $subKey.GetValue("$spdup")
$enum = $subKey.OpenSubKey("Ndi\Params\$spdup\Enum")
$ValNames = $enum.getvaluenames()
foreach ($val in $ValNames)
{
$CBSpeedDuplex.Items.add($enum.getvalue("$val"))
$CBSpeedDuplex.SelectedIndex = $sd
}
}
catch
{
$cbspeedduplex.enabled = $false
$cbspeedduplex.text = "No speed/duplex setting available"
}
$tDver.Text = $subKey.GetValue("DriverVersion")
$tDdat.Text = $subKey.GetValue("DriverDate")
$tman.Text = $subKey.GetValue("ProviderName")
}
}
}
}
#endregion userfunctions
$handler_button2_Click={
#TODO: Place custom script here
refresh
get-NicSettings
}
$handler_cb1_SelectedIndexChanged={
#TODO: Place custom script here
refresh
Get-NicSettings
}
$handler_button1_Click={
#TODO: Place custom script here
$form1.Close()
}
$handler_btChange_Click={
#Do a check on the DHCP checkbox
$mbresult = [System.Windows.Forms.MessageBox]::show("Changes will be made to the registry. Are you shure?","Writing changes...", `
[System.Windows.Forms.MessageBoxButtons]::OKCancel, [System.Windows.Forms.MessageBoxIcon]::exclamation)
if ($mbresult -eq "Ok")
{
$NIC = Get-WMIObject -Query "Select * From Win32_NetworkAdapterConfiguration where index = $indexnum"
#tell WMI that we are going to use static addresses and set IP address and default gateway.
Set-Location hklm:\
Set-Location hklm:"\$ippath"
if ($checkDHCP.Checked -eq $false)
{
setstatic
}
else
{
clearstatic
}
}
else
{
$statusbar1.Text = "Cancel pressed... Nothing written."
}
}
$handler_checkDHCP_MouseClick=[System.Windows.Forms.MouseEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.MouseEventArgs]
#TODO: Place custom script here
Set-Location hklm:\
Set-Location hklm:"\$ippath"
if ($checkDHCP.Checked -eq $false)
{
set-variable -Name cb4state -value 1 -Scope script
enable-static
Set-ItemProperty -Path .\. -Name enabledhcp -Value 0
Set-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" -Name enabledhcp -Value 0
}
Else
{
set-variable -Name cb4state -value $null -Scope script
disable-static
Set-ItemProperty -Path .\. -Name enabledhcp -Value 1
Set-ItemProperty -Path hklm:"\system\currentcontrolset\services\$ID\parameters\tcpip" -Name enabledhcp -Value 1
clearstatic
}
}
#region button-updown
#-----------------------------------------------------------------------------------
$handler_button15_Click={
#TODO: Place custom script here
if ($listDNS.SelectedItem -ne $null)
{
$scount = ((($count -1) -$count)+ $swap)
$iitem = $sitem
$ListDNS.items.Removeat($swap)
$ListDNS.items.insert($scount, $iitem)
$ListDNS.Refresh()
$ListDNS.selecteditem = $iitem
}
}
$handler_button16_Click={
#TODO: Place custom script here
if ($ListDNS.SelectedItem -ne $null)
{
$scount = ((($count +1) -$count)+ $swap)
$iitem = $sitem
$ListDNS.items.Removeat($swap)
$ListDNS.items.insert($scount, $iitem)
$ListDNS.Refresh()
$ListDNS.selecteditem = $iitem
}
}
$handler_listDNS_MouseClick=[System.Windows.Forms.MouseEventHandler] {
#Event Argument: $_ = [System.Windows.Forms.MouseEventArgs]
#TODO: Place custom script here
Set-Variable -Name swap -value $ListDNS.SelectedIndex -Scope script
Set-Variable -Name sitem -value $ListDNS.selecteditem -Scope script
Set-Variable -Name count -value ($ListDNS.Items.Count - 1) -Scope script
if ($swap -gt "0")
{
$button15.Enabled = $true
}
else
{
$button15.Enabled = $false
}
if ($swap -lt $count)
{
$button16.Enabled = $true
}
else
{
$button16.Enabled = $false
}
}
$handler_listDNS_SelectedIndexChanged={
#TODO: Place custom script here
$DNSedt.Enabled = $true
$DNSrem.Enabled = $true
$tDNSadd.Text = $listDNS.SelectedItem
Set-Variable -Name swap -value $ListDNS.SelectedIndex -Scope script
Set-Variable -Name sitem -value $ListDNS.selecteditem -Scope script
Set-Variable -Name count -value ($ListDNS.Items.Count - 1) -Scope script
if ($swap -gt "0")
{
$button15.Enabled = $true
}
else
{
$button15.Enabled = $false
}
if ($swap -lt $count)
{
$button16.Enabled = $true
}
else
{
$button16.Enabled = $false
}
$tpdns.text = $listdns.Items[0]
$tsdns.text = $listdns.items[1]
}
$handler_button8_Click={
#TODO: Place custom script here
if ($listbox1.SelectedItem -ne $null)
{
$scount = ((($count -1) -$count)+ $swap)
$iitem = $sitem.TrimEnd(" ")
$Listbox1.items.Removeat($swap)
$Listbox1.items.insert($scount, $iitem)
$Listbox1.Refresh()
# [system.Windows.Forms.MessageBox]::Show("nvspbind " + $iitem + " ms_tcpip /+")
"---------------------------------------------------------" | Out-file d:\log\nvspbindlog.txt -Append
Get-Date | Out-file d:\log\nvspbindlog.txt -Append
nvspbind $iitem ms_tcpip /- | Out-file -FilePath d:\log\nvspbindlog.txt -Append
"=========================================================" | Out-file d:\log\nvspbindlog.txt -Append
$Listbox1.selecteditem = $iitem
}
}
$handler_button9_Click={
#TODO: Place custom script here
if ($ListBox1.SelectedItem -ne $null)
{
$scount = ((($count +1) -$count)+ $swap)
$iitem = $sitem.TrimEnd(" ")
$ListBox1.items.Removeat($swap)
$ListBox1.items.insert($scount, $iitem)
$ListBox1.Refresh()
"---------------------------------------------------------" | Out-file d:\log\nvspbindlog.txt -Append
Get-Date | Out-file d:\log\nvspbindlog.txt
nvspbind $iitem ms_tcpip /- | Out-file -FilePath d:\log\nvspbindlog.txt -Append
"=========================================================" | Out-file d:\log\nvspbindlog.txt -Append
$ListBox1.selecteditem = $iitem
}
}
$handler_listbox1_SelectedIndexChanged={
#TODO: Place custom script here
Set-Variable -Name swap -value $listbox1.SelectedIndex -Scope script
Set-Variable -Name sitem -value $listbox1.selecteditem -Scope script
Set-Variable -Name count -value ($listbox1.Items.Count - 1) -Scope script
if ($swap -gt "0")
{
$button8.Enabled = $true
}
else
{
$button8.Enabled = $false
}
if ($swap -lt $count)
{
$button9.Enabled = $true
}
else
{
$button9.Enabled = $false
}
}
$handler_listbox1_MouseClick=[System.Windows.Forms.MouseEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.MouseEventArgs]
#TODO: Place custom script here
Set-Variable -Name swap -value $listbox1.SelectedIndex -Scope script
Set-Variable -Name sitem -value $listbox1.selecteditem -Scope script
Set-Variable -Name count -value ($listbox1.Items.Count - 1) -Scope script
if ($swap -gt "0")
{
$button8.Enabled = $true
}
else
{
$button8.Enabled = $false
}
if ($swap -lt $count)
{
$button9.Enabled = $true
}
else
{
$button9.Enabled = $false
}
}
$handler_button5_Click={
#TODO: Place custom script here
if ($ListDNSsearch.SelectedItem -ne $null)
{
$scount = ((($count -1) -$count)+ $swap)
$iitem = $sitem
$ListDNSsearch.items.Removeat($swap)
$ListDNSsearch.items.insert($scount, $iitem)
$ListDNSsearch.Refresh()
$ListDNSsearch.selecteditem = $iitem
}
}
$handler_button6_Click={
#TODO: Place custom script here
if ($ListDNSsearch.SelectedItem -ne $null)
{
$scount = ((($count +1) -$count)+ $swap)
$iitem = $sitem
$ListDNSsearch.items.Removeat($swap)
$ListDNSsearch.items.insert($scount, $iitem)
$ListDNSsearch.Refresh()
$ListDNSsearch.selecteditem = $iitem
}
}
$handler_ListDNSsearch_MouseClick = [System.Windows.Forms.MouseEventHandler]{
#TODO: Place custom script here
Set-Variable -Name swap -value $ListDNSsearch.SelectedIndex -Scope script
Set-Variable -Name sitem -value $ListDNSsearch.selecteditem -Scope script
Set-Variable -Name count -value ($ListDNSsearch.Items.Count - 1) -Scope script
if ($swap -gt "0")
{
$button5.Enabled = $true
}
else
{
$button5.Enabled = $false
}
if ($swap -lt $count)
{
$button6.Enabled = $true
}
else
{
$button6.Enabled = $false
}
$tDNSsearchAdd.Text = $sitem
}
$handler_ListDNSsearch_SelectedIndexChanged={
#TODO: Place custom script here
Set-Variable -Name swap -value $ListDNSsearch.SelectedIndex -Scope script
Set-Variable -Name sitem -value $ListDNSsearch.selecteditem -Scope script
Set-Variable -Name count -value ($ListDNSsearch.Items.Count - 1) -Scope script
if ($swap -gt "0")
{
$button5.Enabled = $true
}
else
{
$button5.Enabled = $false
}
if ($swap -lt $count)
{
$button6.Enabled = $true
}
else
{
$button6.Enabled = $false
}
$tDNSsearchAdd.Text = $sitem
# $tDNSsearchAdd.Text = $null
}
#endregion
$handler_DNSrem_Click={
#TODO: Place custom script here
$ListDNS.items.Remove($listDNS.SelectedItem)
$ListDNS.Update
$tDNSadd.Text = $null
$tpdns.text = $listdns.Items[0]
$tsdns.text = $listdns.items[1]
$DNSrem.Enabled = $false
$DNSedt.Enabled = $false
}
$handler_DNSedt_Click={
#TODO: Place custom script here
$dnsix = $listDNS.SelectedIndex
$dnstext = $tDNSadd.text
$ListDNS.items.Removeat($DNSix)
$ListDNS.Items.insert($dnsix,$dnstext)
$ListDNS.Update
$tDNSadd.Text = $null
$tpdns.text = $listdns.Items[0]
$tsdns.text = $listdns.items[1]
$DNSrem.Enabled = $false
$DNSedt.Enabled = $false
}
$handler_DNSadd_Click={
#TODO: Place custom script here
$ListDNS.Items.Add($tDNSadd.Text)
$ListDNS.Update
$tDNSadd.Text = $null
$tpdns.text = $listdns.Items[0]
$tsdns.text = $listdns.items[1]
}
$handler_DNSsearchAdd_Click={
#TODO: Place custom script here
$ListDNSsearch.Items.Add($tDNSsearchAdd.Text)
$ListDNSsearch.Update
$tDNSsearchadd.Text = $null
}
$handler_DNSsearchEdt_Click={
#TODO: Place custom script here
$dnsix = $listDNSsearch.SelectedIndex
$dnssearchtext = $tDNSsearchadd.text
$ListDNSsearch.items.Removeat($DNSix)
$ListDNSsearch.Items.insert($dnsix,$dnssearchtext)
$ListDNSsearch.Update
$tDNSsearchadd.Text = $null
}
$handler_DNSsearchRem_Click={
#TODO: Place custom script here
$ListDNSsearch.items.Remove($listDNSsearch.SelectedItem)
$ListDNSsearch.Update
$tDNSsearchadd.Text = $null
}
$handler_button17_Click={
#TODO: Place custom script here
########################################################################
# Code Generated By: SAPIEN Technologies, Inc., PrimalForms 2009 v1.1.11.0
# Generated On: 13-4-2011 7:56
# Generated By: Jack van Deur
# Organization: Q-serv (www.q-serv.nl)
########################################################################
#----------------------------------------------
#region Application Functions
#----------------------------------------------
function OnApplicationLoad {
#Note: This function runs before the form is created
#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
#Important: Form controls cannot be accessed in this function
#TODO: Add snapins and custom code to validate the application load
return $true #return true for success or false for failure
}
function OnApplicationExit {
#Note: This function runs after the form is closed
#TODO: Add custom code to clean up and unload snapins when the application exits
$script:ExitCode = 0 #Set the exit code for the Packager
}
#endregion
#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function GenerateForm {
#----------------------------------------------
#region Import Assemblies
#----------------------------------------------
[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("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[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")
#endregion
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object System.Windows.Forms.Form
$button1 = New-Object System.Windows.Forms.Button
$picturebox2 = New-Object System.Windows.Forms.PictureBox
$picturebox1 = New-Object System.Windows.Forms.PictureBox
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$FormEvent_Load={
#TODO: Initialize Form Controls here
}
$handler_button1_Click={
#TODO: Place custom script here
$form1.Close()
}
#----------------------------------------------
# Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
#
# form1
#
$form1.Controls.Add($button1)
$form1.Controls.Add($picturebox2)
$form1.Controls.Add($picturebox1)
$form1.BackColor = [System.Drawing.Color]::FromArgb(255,244,247,252)
$form1.ClientSize = New-Object System.Drawing.Size(426,249)
$form1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$form1.Name = "form1"
$form1.Text = "About AdapterConfigurator"
$form1.add_Load($FormEvent_Load)
#
# button1
#
$button1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$button1.Location = New-Object System.Drawing.Point(344,222)
$button1.Name = "button1"
$button1.Size = New-Object System.Drawing.Size(75,23)
$button1.TabIndex = 2
$button1.Text = "Close"
$button1.UseVisualStyleBackColor = $True
$button1.add_Click($handler_button1_Click)
#
# picturebox2
#
$picturebox2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$picturebox2.Image = [System.Drawing.Image]::FromFile("C:\Users\Jack\Pictures\adapter configurator.png")
$picturebox2.Location = New-Object System.Drawing.Point(200,13)
$picturebox2.Name = "picturebox2"
$picturebox2.Size = New-Object System.Drawing.Size(219,203)
$picturebox2.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::StretchImage
$picturebox2.TabIndex = 1
$picturebox2.TabStop = $False
#
# picturebox1
#
$picturebox1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$picturebox1.Image = [System.Drawing.Image]::FromFile("C:\Users\Jack\Documents\Eenmanszaak\logo's\Logoletterhead 300 q-serv_48.gif")
$picturebox1.Location = New-Object System.Drawing.Point(12,12)
$picturebox1.Name = "picturebox1"
$picturebox1.Size = New-Object System.Drawing.Size(157,204)
$picturebox1.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::StretchImage
$picturebox1.TabIndex = 0
$picturebox1.TabStop = $False
#endregion Generated Form Code
#----------------------------------------------
#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($Form_StateCorrection_Load)
#Show the Form
return $form1.ShowDialog()
} #End Function
#Call OnApplicationLoad to initialize
if(OnApplicationLoad -eq $true)
{
#Create the form
GenerateForm | Out-Null
#Perform cleanup
OnApplicationExit
}
}
$handler_cb1_MouseClick={
#TODO: Place custom script here
if ($boardinfo -ne 1) {
if ($cb1.Items.Count -gt 0) {
$boardinfo = 1
}
get-boards
}
else
{
$boardinfo = 0
}
}
$handler_BtServer_Click={
#TODO: Place custom script here
$server = Read-Host -Prompt "Please enter the servername to work on...."
try
{
Enter-PSSession -ErrorVariable PSSessionError $server -Credential ""
$listbox1.Items.clear()
}
catch
{
[System.Windows.Forms.MessageBox]::Show($pssessionError)
}
if ($pssessionError = $null)
{
[string]$nvsp = invoke-command (nvspbind /o ms_tcpip)
fNVSPbind
}
}
$handler_tDNSadd_Enter={
#TODO: Place custom script here
$statusbar1.Text = "Use this field to add, remove or edit DNS name server entries. (You have to select an entry before you can edit or remove)"
}
#----------------------------------------------
# Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
#
# form1
#
$form1.Controls.Add($statusbar1)
$form1.Controls.Add($BtServer)
$form1.Controls.Add($button17)
$form1.Controls.Add($groupbox1)
$form1.Controls.Add($groupbox5)
$form1.Controls.Add($btChange)
$form1.Controls.Add($button2)
$form1.Controls.Add($button1)
$form1.Controls.Add($groupbox4)
$form1.Controls.Add($groupbox3)
$form1.Controls.Add($groupbox2)
$form1.ClientSize = New-Object System.Drawing.Size(841,496)
$form1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$form1.Name = "form1"
$form1.Text = "Adapter Configuration Form"
$form1.add_Load($FormEvent_Load)
#
# statusbar1
#
$statusbar1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$statusbar1.Location = New-Object System.Drawing.Point(0,474)
$statusbar1.Name = "statusbar1"
$statusbar1.Size = New-Object System.Drawing.Size(841,22)
$statusbar1.TabIndex = 27
#
# BtServer
#
$BtServer.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$BtServer.Location = New-Object System.Drawing.Point(192,445)
$BtServer.Name = "BtServer"
$BtServer.Size = New-Object System.Drawing.Size(133,23)
$BtServer.TabIndex = 26
$BtServer.Text = "Select server"
$BtServer.UseVisualStyleBackColor = $True
$BtServer.add_Click($handler_BtServer_Click)
#
# button17
#
$button17.AccessibleRole = [System.Windows.Forms.AccessibleRole]::HelpBalloon
$button17.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$button17.Location = New-Object System.Drawing.Point(331,445)
$button17.Name = "button17"
$button17.Size = New-Object System.Drawing.Size(133,23)
$button17.TabIndex = 25
$button17.Text = "Ab&out"
$button17.UseVisualStyleBackColor = $True
$button17.add_Click($handler_button17_Click)
#
# groupbox1
#
$groupbox1.Controls.Add($tDNSadd)
$groupbox1.Controls.Add($DNSrem)
$groupbox1.Controls.Add($DNSedt)
$groupbox1.Controls.Add($DNSadd)
$groupbox1.Controls.Add($listDNS)
$groupbox1.Controls.Add($DNSsearchEdt)
$groupbox1.Controls.Add($DNSsearchRem)
$groupbox1.Controls.Add($DNSsearchAdd)
$groupbox1.Controls.Add($tDNSsearchAdd)
$groupbox1.Controls.Add($label17)
$groupbox1.Controls.Add($button16)
$groupbox1.Controls.Add($button6)
$groupbox1.Controls.Add($button15)
$groupbox1.Controls.Add($button5)
$groupbox1.Controls.Add($ListDNSsearch)
$groupbox1.Controls.Add($label8)
$groupbox1.Controls.Add($tDNSSuf)
$groupbox1.Controls.Add($checkbox2)
$groupbox1.Controls.Add($checkbox1)
$groupbox1.Controls.Add($label4)
$groupbox1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupbox1.Location = New-Object System.Drawing.Point(331,192)
$groupbox1.Name = "groupbox1"
$groupbox1.Size = New-Object System.Drawing.Size(493,245)
$groupbox1.TabIndex = 2
$groupbox1.TabStop = $False
$groupbox1.Text = "DNS Info"
#
# tDNSadd
#
$tDNSadd.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tDNSadd.Location = New-Object System.Drawing.Point(9,112)
$tDNSadd.Name = "tDNSadd"
$tDNSadd.Size = New-Object System.Drawing.Size(183,20)
$tDNSadd.TabIndex = 5
$tDNSadd.Text = "Enter DNS server IP addresses here"
$tDNSadd.add_Enter($handler_tDNSadd_Enter)
#
# DNSrem
#
$DNSrem.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$DNSrem.Enabled = $False
$DNSrem.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",6.75,0,3,1)
$DNSrem.Location = New-Object System.Drawing.Point(75,135)
$DNSrem.Name = "DNSrem"
$DNSrem.Size = New-Object System.Drawing.Size(49,23)
$DNSrem.TabIndex = 7
$DNSrem.Text = "Remo&ve"
$DNSrem.UseVisualStyleBackColor = $True
$DNSrem.add_Click($handler_DNSrem_Click)
#
# DNSedt
#
$DNSedt.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$DNSedt.Enabled = $False
$DNSedt.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",6.75,0,3,1)
$DNSedt.Location = New-Object System.Drawing.Point(143,135)
$DNSedt.Name = "DNSedt"
$DNSedt.Size = New-Object System.Drawing.Size(49,23)
$DNSedt.TabIndex = 8
$DNSedt.Text = "Edi&t"
$DNSedt.UseVisualStyleBackColor = $True
$DNSedt.add_Click($handler_DNSedt_Click)
#
# DNSadd
#
$DNSadd.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$DNSadd.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",6.75,0,3,1)
$DNSadd.Location = New-Object System.Drawing.Point(9,135)
$DNSadd.Name = "DNSadd"
$DNSadd.Size = New-Object System.Drawing.Size(49,23)
$DNSadd.TabIndex = 6
$DNSadd.Text = "&Add"
$DNSadd.UseVisualStyleBackColor = $True
$DNSadd.add_Click($handler_DNSadd_Click)
#
# listDNS
#
$listDNS.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$listDNS.Enabled = $False
$listDNS.FormattingEnabled = $True
$listDNS.Location = New-Object System.Drawing.Point(9,36)
$listDNS.Name = "listDNS"
$listDNS.Size = New-Object System.Drawing.Size(182,69)
$listDNS.TabIndex = 4
$listDNS.TabStop = $False
$listDNS.add_MouseClick($handler_listDNS_MouseClick)
$listDNS.add_SelectedIndexChanged($handler_listDNS_SelectedIndexChanged)
#
# DNSsearchEdt
#
$DNSsearchEdt.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$DNSsearchEdt.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",6.75,0,3,1)
$DNSsearchEdt.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$DNSsearchEdt.Location = New-Object System.Drawing.Point(397,135)
$DNSsearchEdt.Name = "DNSsearchEdt"
$DNSsearchEdt.Size = New-Object System.Drawing.Size(50,22)
$DNSsearchEdt.TabIndex = 15
$DNSsearchEdt.Text = "Edit"
$DNSsearchEdt.UseVisualStyleBackColor = $True
$DNSsearchEdt.add_Click($handler_DNSsearchEdt_Click)
#
# DNSsearchRem
#
$DNSsearchRem.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$DNSsearchRem.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",6.75,0,3,1)
$DNSsearchRem.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$DNSsearchRem.Location = New-Object System.Drawing.Point(331,135)
$DNSsearchRem.Name = "DNSsearchRem"
$DNSsearchRem.Size = New-Object System.Drawing.Size(50,22)
$DNSsearchRem.TabIndex = 14
$DNSsearchRem.Text = "Remove"
$DNSsearchRem.UseVisualStyleBackColor = $True
$DNSsearchRem.add_Click($handler_DNSsearchRem_Click)
#
# DNSsearchAdd
#
$DNSsearchAdd.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$DNSsearchAdd.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",6.75,0,3,1)
$DNSsearchAdd.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$DNSsearchAdd.Location = New-Object System.Drawing.Point(266,136)
$DNSsearchAdd.Name = "DNSsearchAdd"
$DNSsearchAdd.Size = New-Object System.Drawing.Size(50,22)
$DNSsearchAdd.TabIndex = 13
$DNSsearchAdd.Text = "Add"
$DNSsearchAdd.UseVisualStyleBackColor = $True
$DNSsearchAdd.add_Click($handler_DNSsearchAdd_Click)
#
# tDNSsearchAdd
#
$tDNSsearchAdd.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tDNSsearchAdd.Location = New-Object System.Drawing.Point(266,112)
$tDNSsearchAdd.Name = "tDNSsearchAdd"
$tDNSsearchAdd.Size = New-Object System.Drawing.Size(181,20)
$tDNSsearchAdd.TabIndex = 12
#
# label17
#
$label17.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label17.Location = New-Object System.Drawing.Point(266,16)
$label17.Name = "label17"
$label17.Size = New-Object System.Drawing.Size(162,17)
$label17.TabIndex = 9
$label17.Text = "DNS SearchOrder"
#
# button16
#
$button16.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$button16.Enabled = $False
$button16.Image = [System.Drawing.Image]::FromFile("C:\Users\Jack\Pictures\arrow down.PNG")
$button16.Location = New-Object System.Drawing.Point(198,76)
$button16.Name = "button16"
$button16.Size = New-Object System.Drawing.Size(29,29)
$button16.TabIndex = 11
$button16.TabStop = $False
$button16.UseVisualStyleBackColor = $True
$button16.add_Click($handler_button16_Click)
#
# button6
#
$button6.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$button6.Enabled = $False
$button6.Image = [System.Drawing.Image]::FromFile("C:\Users\Jack\Pictures\arrow down.PNG")
$button6.Location = New-Object System.Drawing.Point(453,76)
$button6.Name = "button6"
$button6.Size = New-Object System.Drawing.Size(29,29)
$button6.TabIndex = 11
$button6.TabStop = $False
$button6.UseVisualStyleBackColor = $True
$button6.add_Click($handler_button6_Click)
#
# button15
#
$button15.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$button15.Enabled = $False
$button15.Image = [System.Drawing.Image]::FromFile("C:\Users\Jack\Pictures\arrow up.PNG")
$button15.Location = New-Object System.Drawing.Point(198,36)
$button15.Name = "button15"
$button15.Size = New-Object System.Drawing.Size(29,29)
$button15.TabIndex = 11
$button15.TabStop = $False
$button15.UseVisualStyleBackColor = $True
$button15.add_Click($handler_button15_Click)
#
# button5
#
$button5.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$button5.Enabled = $False
$button5.Image = [System.Drawing.Image]::FromFile("C:\Users\Jack\Pictures\arrow up.PNG")
$button5.Location = New-Object System.Drawing.Point(453,36)
$button5.Name = "button5"
$button5.Size = New-Object System.Drawing.Size(29,29)
$button5.TabIndex = 11
$button5.TabStop = $False
$button5.UseVisualStyleBackColor = $True
$button5.add_Click($handler_button5_Click)
#
# ListDNSsearch
#
$ListDNSsearch.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$ListDNSsearch.Enabled = $False
$ListDNSsearch.FormattingEnabled = $True
$ListDNSsearch.Location = New-Object System.Drawing.Point(266,36)
$ListDNSsearch.Name = "ListDNSsearch"
$ListDNSsearch.Size = New-Object System.Drawing.Size(182,69)
$ListDNSsearch.TabIndex = 10
$ListDNSsearch.TabStop = $False
$ListDNSsearch.add_MouseClick($handler_ListDNSsearch_MouseClick)
$ListDNSsearch.add_SelectedIndexChanged($handler_ListDNSsearch_SelectedIndexChanged)
#
# label8
#
$label8.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label8.Location = New-Object System.Drawing.Point(8,174)
$label8.Name = "label8"
$label8.Size = New-Object System.Drawing.Size(61,17)
$label8.TabIndex = 8
$label8.Text = "DNS Suffix"
#
# tDNSSuf
#
$tDNSSuf.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tDNSSuf.Location = New-Object System.Drawing.Point(75,171)
$tDNSSuf.Name = "tDNSSuf"
$tDNSSuf.Size = New-Object System.Drawing.Size(162,20)
$tDNSSuf.TabIndex = 9
#
# checkbox2
#
$checkbox2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$checkbox2.Location = New-Object System.Drawing.Point(8,216)
$checkbox2.Name = "checkbox2"
$checkbox2.Size = New-Object System.Drawing.Size(281,24)
$checkbox2.TabIndex = 11
$checkbox2.Text = "Use this connection's DNS suffix in DNS registration"
$checkbox2.UseVisualStyleBackColor = $True
#
# checkbox1
#
$checkbox1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$checkbox1.Location = New-Object System.Drawing.Point(8,197)
$checkbox1.Name = "checkbox1"
$checkbox1.Size = New-Object System.Drawing.Size(239,24)
$checkbox1.TabIndex = 10
$checkbox1.Text = "Register this connection's addresses in DNS"
$checkbox1.UseVisualStyleBackColor = $True
#
# label4
#
$label4.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label4.Location = New-Object System.Drawing.Point(8,16)
$label4.Name = "label4"
$label4.Size = New-Object System.Drawing.Size(100,17)
$label4.TabIndex = 1
$label4.Text = "DNS servers"
#
# groupbox5
#
$groupbox5.Controls.Add($listbox1)
$groupbox5.Controls.Add($button8)
$groupbox5.Controls.Add($button9)
$groupbox5.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupbox5.Location = New-Object System.Drawing.Point(13,272)
$groupbox5.Name = "groupbox5"
$groupbox5.Size = New-Object System.Drawing.Size(312,165)
$groupbox5.TabIndex = 9
$groupbox5.TabStop = $False
$groupbox5.Text = "TCPIP Binding order"
#
# listbox1
#
$listbox1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$listbox1.FormattingEnabled = $True
$listbox1.Location = New-Object System.Drawing.Point(7,20)
$listbox1.Name = "listbox1"
$listbox1.Size = New-Object System.Drawing.Size(264,69)
$listbox1.TabIndex = 0
$listbox1.add_MouseClick($handler_listbox1_MouseClick)
$listbox1.add_SelectedIndexChanged($handler_listbox1_SelectedIndexChanged)
#
# button8
#
$button8.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$button8.Enabled = $False
$button8.Image = [System.Drawing.Image]::FromFile("C:\Users\Jack\Pictures\arrow up.PNG")
$button8.Location = New-Object System.Drawing.Point(277,20)
$button8.Name = "button8"
$button8.Size = New-Object System.Drawing.Size(29,29)
$button8.TabIndex = 11
$button8.UseVisualStyleBackColor = $True
$button8.add_Click($handler_button8_Click)
#
# button9
#
$button9.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$button9.Enabled = $False
$button9.Image = [System.Drawing.Image]::FromFile("C:\Users\Jack\Pictures\arrow down.PNG")
$button9.Location = New-Object System.Drawing.Point(277,60)
$button9.Name = "button9"
$button9.Size = New-Object System.Drawing.Size(29,29)
$button9.TabIndex = 11
$button9.UseVisualStyleBackColor = $True
$button9.add_Click($handler_button9_Click)
#
# btChange
#
$btChange.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$btChange.Location = New-Object System.Drawing.Point(12,445)
$btChange.Name = "btChange"
$btChange.Size = New-Object System.Drawing.Size(174,23)
$btChange.TabIndex = 22
$btChange.Text = "Change &Settings"
$btChange.UseVisualStyleBackColor = $True
$btChange.add_Click($handler_btChange_Click)
#
# button2
#
$button2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$button2.Location = New-Object System.Drawing.Point(470,445)
$button2.Name = "button2"
$button2.Size = New-Object System.Drawing.Size(174,23)
$button2.TabIndex = 23
$button2.Text = "&Refresh Window"
$button2.UseVisualStyleBackColor = $True
$button2.add_Click($handler_button2_Click)
#
# button1
#
$button1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$button1.Location = New-Object System.Drawing.Point(650,445)
$button1.Name = "button1"
$button1.Size = New-Object System.Drawing.Size(174,23)
$button1.TabIndex = 24
$button1.Text = "&Close"
$button1.UseVisualStyleBackColor = $True
$button1.add_Click($handler_button1_Click)
#
# groupbox4
#
$groupbox4.Controls.Add($tiID)
$groupbox4.Controls.Add($label20)
$groupbox4.Controls.Add($lMan)
$groupbox4.Controls.Add($tMan)
$groupbox4.Controls.Add($CBSpeedDuplex)
$groupbox4.Controls.Add($label13)
$groupbox4.Controls.Add($label14)
$groupbox4.Controls.Add($label12)
$groupbox4.Controls.Add($label11)
$groupbox4.Controls.Add($label10)
$groupbox4.Controls.Add($tNIC)
$groupbox4.Controls.Add($tDdat)
$groupbox4.Controls.Add($label9)
$groupbox4.Controls.Add($tDver)
$groupbox4.Controls.Add($cb1)
$groupbox4.Controls.Add($tMac)
$groupbox4.Controls.Add($tLoc)
$groupbox4.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupbox4.Location = New-Object System.Drawing.Point(13,13)
$groupbox4.Name = "groupbox4"
$groupbox4.Size = New-Object System.Drawing.Size(312,253)
$groupbox4.TabIndex = 0
$groupbox4.TabStop = $False
$groupbox4.Text = "Adapter Info"
#
# tiID
#
$tiID.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tiID.Enabled = $False
$tiID.Location = New-Object System.Drawing.Point(103,95)
$tiID.Name = "tiID"
$tiID.Size = New-Object System.Drawing.Size(203,20)
$tiID.TabIndex = 9
$tiID.TabStop = $False
#
# label20
#
$label20.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label20.Location = New-Object System.Drawing.Point(9,98)
$label20.Name = "label20"
$label20.Size = New-Object System.Drawing.Size(73,19)
$label20.TabIndex = 8
$label20.Text = "Interface ID"
#
# lMan
#
$lMan.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$lMan.Location = New-Object System.Drawing.Point(8,152)
$lMan.Name = "lMan"
$lMan.Size = New-Object System.Drawing.Size(76,15)
$lMan.TabIndex = 7
$lMan.Text = "Manufacturer"
#
# tMan
#
$tMan.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tMan.Enabled = $False
$tMan.Location = New-Object System.Drawing.Point(103,145)
$tMan.Name = "tMan"
$tMan.Size = New-Object System.Drawing.Size(203,20)
$tMan.TabIndex = 6
$tMan.TabStop = $False
#
# CBSpeedDuplex
#
$CBSpeedDuplex.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$CBSpeedDuplex.FormattingEnabled = $True
$CBSpeedDuplex.Location = New-Object System.Drawing.Point(103,223)
$CBSpeedDuplex.Name = "CBSpeedDuplex"
$CBSpeedDuplex.Size = New-Object System.Drawing.Size(203,21)
$CBSpeedDuplex.TabIndex = 5
$CBSpeedDuplex.TabStop = $False
#
# label13
#
$label13.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label13.Location = New-Object System.Drawing.Point(8,48)
$label13.Name = "label13"
$label13.Size = New-Object System.Drawing.Size(75,17)
$label13.TabIndex = 2
$label13.Text = "Logical Name"
#
# label14
#
$label14.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label14.Location = New-Object System.Drawing.Point(8,226)
$label14.Name = "label14"
$label14.Size = New-Object System.Drawing.Size(90,18)
$label14.TabIndex = 2
$label14.Text = "Speed / Duplex"
#
# label12
#
$label12.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label12.Location = New-Object System.Drawing.Point(9,195)
$label12.Name = "label12"
$label12.Size = New-Object System.Drawing.Size(75,17)
$label12.TabIndex = 2
$label12.Text = "Driver Date"
#
# label11
#
$label11.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label11.Location = New-Object System.Drawing.Point(7,174)
$label11.Name = "label11"
$label11.Size = New-Object System.Drawing.Size(75,17)
$label11.TabIndex = 2
$label11.Text = "Driver version"
#
# label10
#
$label10.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label10.Location = New-Object System.Drawing.Point(9,126)
$label10.Name = "label10"
$label10.Size = New-Object System.Drawing.Size(75,17)
$label10.TabIndex = 2
$label10.Text = "MacAddress"
#
# tNIC
#
$tNIC.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tNIC.Enabled = $False
$tNIC.Location = New-Object System.Drawing.Point(103,43)
$tNIC.Name = "tNIC"
$tNIC.Size = New-Object System.Drawing.Size(203,20)
$tNIC.TabIndex = 4
$tNIC.TabStop = $False
#
# tDdat
#
$tDdat.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tDdat.Enabled = $False
$tDdat.Location = New-Object System.Drawing.Point(103,197)
$tDdat.Name = "tDdat"
$tDdat.Size = New-Object System.Drawing.Size(203,20)
$tDdat.TabIndex = 4
$tDdat.TabStop = $False
#
# label9
#
$label9.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label9.Location = New-Object System.Drawing.Point(7,72)
$label9.Name = "label9"
$label9.Size = New-Object System.Drawing.Size(75,23)
$label9.TabIndex = 1
$label9.Text = "Location info"
#
# tDver
#
$tDver.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tDver.Enabled = $False
$tDver.Location = New-Object System.Drawing.Point(103,171)
$tDver.Name = "tDver"
$tDver.Size = New-Object System.Drawing.Size(203,20)
$tDver.TabIndex = 4
$tDver.TabStop = $False
#
# cb1
#
$cb1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$cb1.FormattingEnabled = $True
$cb1.Location = New-Object System.Drawing.Point(7,18)
$cb1.Name = "cb1"
$cb1.Size = New-Object System.Drawing.Size(299,21)
$cb1.Sorted = $True
$cb1.TabIndex = 0
$cb1.Text = "Select a board to inspect"
$cb1.add_MouseClick($handler_cb1_MouseClick)
$cb1.add_SelectedIndexChanged($handler_cb1_SelectedIndexChanged)
#
# tMac
#
$tMac.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tMac.Enabled = $False
$tMac.Location = New-Object System.Drawing.Point(103,120)
$tMac.Name = "tMac"
$tMac.Size = New-Object System.Drawing.Size(203,20)
$tMac.TabIndex = 4
$tMac.TabStop = $False
#
# tLoc
#
$tLoc.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tLoc.Enabled = $False
$tLoc.Location = New-Object System.Drawing.Point(103,69)
$tLoc.Name = "tLoc"
$tLoc.Size = New-Object System.Drawing.Size(203,20)
$tLoc.TabIndex = 4
$tLoc.TabStop = $False
#
# groupbox3
#
$groupbox3.Controls.Add($label19)
$groupbox3.Controls.Add($label18)
$groupbox3.Controls.Add($checkDHCP)
$groupbox3.Controls.Add($label3)
$groupbox3.Controls.Add($label2)
$groupbox3.Controls.Add($label1)
$groupbox3.Controls.Add($tsDNS)
$groupbox3.Controls.Add($tDefGW)
$groupbox3.Controls.Add($tpDNS)
$groupbox3.Controls.Add($tSub)
$groupbox3.Controls.Add($tIP)
$groupbox3.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupbox3.Location = New-Object System.Drawing.Point(331,13)
$groupbox3.Name = "groupbox3"
$groupbox3.Size = New-Object System.Drawing.Size(246,173)
$groupbox3.TabIndex = 1
$groupbox3.TabStop = $False
$groupbox3.Text = "IP Settings"
#
# label19
#
$label19.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label19.Location = New-Object System.Drawing.Point(6,123)
$label19.Name = "label19"
$label19.Size = New-Object System.Drawing.Size(100,22)
$label19.TabIndex = 10
$label19.Text = "Secondary DNS"
#
# label18
#
$label18.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label18.Location = New-Object System.Drawing.Point(6,100)
$label18.Name = "label18"
$label18.Size = New-Object System.Drawing.Size(100,23)
$label18.TabIndex = 9
$label18.Text = "Primary DNS"
#
# checkDHCP
#
$checkDHCP.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$checkDHCP.Location = New-Object System.Drawing.Point(7,143)
$checkDHCP.Name = "checkDHCP"
$checkDHCP.Size = New-Object System.Drawing.Size(104,24)
$checkDHCP.TabIndex = 4
$checkDHCP.Text = "DHCP Enabled"
$checkDHCP.UseVisualStyleBackColor = $True
$checkDHCP.add_MouseClick($handler_checkDHCP_MouseClick)
#
# label3
#
$label3.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label3.Location = New-Object System.Drawing.Point(6,72)
$label3.Name = "label3"
$label3.Size = New-Object System.Drawing.Size(100,17)
$label3.TabIndex = 5
$label3.Text = "Default &Gateway"
#
# label2
#
$label2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label2.Location = New-Object System.Drawing.Point(6,46)
$label2.Name = "label2"
$label2.Size = New-Object System.Drawing.Size(100,17)
$label2.TabIndex = 6
$label2.Text = "Subnet Mask"
#
# label1
#
$label1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label1.Location = New-Object System.Drawing.Point(6,22)
$label1.Name = "label1"
$label1.Size = New-Object System.Drawing.Size(100,17)
$label1.TabIndex = 7
$label1.Text = "IP A&ddress"
#
# tsDNS
#
$tsDNS.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tsDNS.Location = New-Object System.Drawing.Point(125,120)
$tsDNS.Name = "tsDNS"
$tsDNS.Size = New-Object System.Drawing.Size(109,20)
$tsDNS.TabIndex = 3
$tsDNS.TabStop = $False
#
# tDefGW
#
$tDefGW.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tDefGW.Location = New-Object System.Drawing.Point(125,69)
$tDefGW.Name = "tDefGW"
$tDefGW.Size = New-Object System.Drawing.Size(109,20)
$tDefGW.TabIndex = 3
#
# tpDNS
#
$tpDNS.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tpDNS.Location = New-Object System.Drawing.Point(125,95)
$tpDNS.Name = "tpDNS"
$tpDNS.Size = New-Object System.Drawing.Size(109,20)
$tpDNS.TabIndex = 2
$tpDNS.TabStop = $False
#
# tSub
#
$tSub.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tSub.Location = New-Object System.Drawing.Point(126,43)
$tSub.Name = "tSub"
$tSub.Size = New-Object System.Drawing.Size(109,20)
$tSub.TabIndex = 2
#
# tIP
#
$tIP.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tIP.Location = New-Object System.Drawing.Point(125,19)
$tIP.Name = "tIP"
$tIP.Size = New-Object System.Drawing.Size(110,20)
$tIP.TabIndex = 1
#
# groupbox2
#
$groupbox2.Controls.Add($rbWins3)
$groupbox2.Controls.Add($rbWins2)
$groupbox2.Controls.Add($rbWins1)
$groupbox2.Controls.Add($checkLMH)
$groupbox2.Controls.Add($label6)
$groupbox2.Controls.Add($label7)
$groupbox2.Controls.Add($TWIP1)
$groupbox2.Controls.Add($tWIP2)
$groupbox2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupbox2.Location = New-Object System.Drawing.Point(583,14)
$groupbox2.Name = "groupbox2"
$groupbox2.Size = New-Object System.Drawing.Size(241,173)
$groupbox2.TabIndex = 3
$groupbox2.TabStop = $False
$groupbox2.Text = "Wins Settings"
#
# rbWins3
#
$rbWins3.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$rbWins3.Location = New-Object System.Drawing.Point(14,147)
$rbWins3.Name = "rbWins3"
$rbWins3.Size = New-Object System.Drawing.Size(104,24)
$rbWins3.TabIndex = 21
$rbWins3.TabStop = $True
$rbWins3.Text = "D&isable"
$rbWins3.UseVisualStyleBackColor = $True
#
# rbWins2
#
$rbWins2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$rbWins2.Location = New-Object System.Drawing.Point(14,123)
$rbWins2.Name = "rbWins2"
$rbWins2.Size = New-Object System.Drawing.Size(104,18)
$rbWins2.TabIndex = 20
$rbWins2.TabStop = $True
$rbWins2.Text = "Ena&ble"
$rbWins2.UseVisualStyleBackColor = $True
#
# rbWins1
#
$rbWins1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$rbWins1.Location = New-Object System.Drawing.Point(14,99)
$rbWins1.Name = "rbWins1"
$rbWins1.Size = New-Object System.Drawing.Size(186,18)
$rbWins1.TabIndex = 19
$rbWins1.TabStop = $True
$rbWins1.Text = "De&fault"
$rbWins1.UseVisualStyleBackColor = $True
#
# checkLMH
#
$checkLMH.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$checkLMH.Location = New-Object System.Drawing.Point(14,69)
$checkLMH.Name = "checkLMH"
$checkLMH.Size = New-Object System.Drawing.Size(186,24)
$checkLMH.TabIndex = 18
$checkLMH.Text = "Ena&ble LMHOSTS Lookup"
$checkLMH.UseVisualStyleBackColor = $True
#
# label6
#
$label6.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label6.Location = New-Object System.Drawing.Point(14,18)
$label6.Name = "label6"
$label6.Size = New-Object System.Drawing.Size(92,20)
$label6.TabIndex = 1
$label6.Text = "Wins IP Adress&1"
#
# label7
#
$label7.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$label7.Location = New-Object System.Drawing.Point(14,48)
$label7.Name = "label7"
$label7.Size = New-Object System.Drawing.Size(92,19)
$label7.TabIndex = 1
$label7.Text = "W&ins IP Address&2"
#
# TWIP1
#
$TWIP1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$TWIP1.Location = New-Object System.Drawing.Point(112,18)
$TWIP1.Name = "TWIP1"
$TWIP1.Size = New-Object System.Drawing.Size(118,20)
$TWIP1.TabIndex = 16
#
# tWIP2
#
$tWIP2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tWIP2.Location = New-Object System.Drawing.Point(112,47)
$tWIP2.Name = "tWIP2"
$tWIP2.Size = New-Object System.Drawing.Size(118,20)
$tWIP2.TabIndex = 17
#endregion Generated Form Code
#----------------------------------------------
#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($Form_StateCorrection_Load)
#Show the Form
return $form1.ShowDialog()
} #End Function
#Call OnApplicationLoad to initialize
if(OnApplicationLoad -eq $true)
{
#Create the form
GenerateForm | Out-Null
#Perform cleanup
OnApplicationExit
}
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (4)
Commented:
I tried to run this executable on my machine, the application is crashing.
Could you please let me know, if i need to do any pre-requisites.
Regards,
Suhas
Author
Commented:sorry to hear that.
First of all you need to run it in elevated mode. I tried it on several machines never had that problem but it throws errors when you don't run in in elevated mode.
So when is it crashing? What OS are you using? Do you have teamed NIC's (as I was unable to test with teaming configurations) What version of Powershell are you using (the app needs version 2).
PLease give me more info.
Kind regards,
JP
Commented:
Thanks,
Suhas
Commented:
This a great example of Powershell at it's finest. I installed it and it works about halfway. I probaly need to go through and change some of the obvious paths for pics and such. But this is a really complete project. Good job and thanks for sharing it.
-R3c0n