______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: cba3a436-2496-4746-bc60-188745e02a46
# Source File: GUI_serverinfo.pff
#------------------------------------------------------------------------
#========================================================================
# Code Generated By: SAPIEN Technologies, Inc., PrimalForms 2011 v2.0.1
# Generated On: 23-4-2011 18:11
# Generated By: FurBall
# Organization: FurBall Productions
#========================================================================
#----------------------------------------------
#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 Application Functions
#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Call-GUI_serverinfo_pff {
#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
#endregion Import Assemblies
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$formulier = New-Object System.Windows.Forms.Form
$groupboxLastReboot = New-Object System.Windows.Forms.GroupBox
$buttonLastReboot = New-Object System.Windows.Forms.Button
$textBoxLastReboot = New-Object System.Windows.Forms.TextBox
$groupBoxComputer = New-Object System.Windows.Forms.GroupBox
$textBoxComputername = New-Object System.Windows.Forms.TextBox
$statusBar1 = New-Object System.Windows.Forms.StatusBar
$tabControl1 = New-Object System.Windows.Forms.TabControl
$tabPage1 = New-Object System.Windows.Forms.TabPage
$groupboxGetDeviants = New-Object System.Windows.Forms.GroupBox
$buttonGetDeviants = New-Object System.Windows.Forms.Button
$groupboxGetServices = New-Object System.Windows.Forms.GroupBox
$buttonGetServices = New-Object System.Windows.Forms.Button
$groupboxStopStartService = New-Object System.Windows.Forms.GroupBox
$buttonStartService = New-Object System.Windows.Forms.Button
$buttonStopService = New-Object System.Windows.Forms.Button
$groupboxChangeStartMode = New-Object System.Windows.Forms.GroupBox
$buttonChangeStartModeToManual = New-Object System.Windows.Forms.Button
$buttonChangeStartModeToDisabled = New-Object System.Windows.Forms.Button
$buttonChangeStartModeToAuto = New-Object System.Windows.Forms.Button
$datagridServices = New-Object System.Windows.Forms.DataGridView
$tabPage2 = New-Object System.Windows.Forms.TabPage
$datagridEvents = New-Object System.Windows.Forms.DataGridView
$buttonGetEvents = New-Object System.Windows.Forms.Button
$groupBox3 = New-Object System.Windows.Forms.GroupBox
$radioButtonDateOrNrOfErrors2 = New-Object System.Windows.Forms.RadioButton
$numericUpDownLast_X_Errors = New-Object System.Windows.Forms.NumericUpDown
$radioButtonDateOrNrOfErrors = New-Object System.Windows.Forms.RadioButton
$dateTimePicker1 = New-Object System.Windows.Forms.DateTimePicker
$groupBox2 = New-Object System.Windows.Forms.GroupBox
$radioButtonApplicationOrSystem2 = New-Object System.Windows.Forms.RadioButton
$radioButtonApplicationOrSystem = New-Object System.Windows.Forms.RadioButton
$tabPage3 = New-Object System.Windows.Forms.TabPage
$dataGridProcesses = New-Object System.Windows.Forms.DataGridView
$buttonStopProcess = New-Object System.Windows.Forms.Button
$buttonGetProcesses = New-Object System.Windows.Forms.Button
$tabPage4 = New-Object System.Windows.Forms.TabPage
$richTextBoxNetworkDetails = New-Object System.Windows.Forms.RichTextBox
$buttonGetNICs = New-Object System.Windows.Forms.Button
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
function RestartScriptInElevatedModeOnWindows7 {
$strScriptName = $myInvocation.ScriptName
# Run script in elevated mode on Windows 7
# Write-Host $myInvocation.ScriptName
# Write-Host $myInvocation.UnboundArguments.Count
# Write-Host $myInvocation.UnboundArguments[0]
#$CurrentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent()
#$WindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($CurrentUser)
#if($WindowsPrincipal.IsInRole("Domain Admins"))
#{
#"User is member of domain admins"
#}
#else
#{
#"User is NOT member of domain admins"
#}
if ((Get-WmiObject Win32_OperatingSystem).Caption -match 'windows 7')
{
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = new-object Security.Principal.WindowsPrincipal $identity
if ($principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -eq $false)
{
$Args = '-noprofile -nologo -executionpolicy bypass -file "{0}"' -f $strScriptName
Start-Process -FilePath 'powershell.exe' -ArgumentList $Args -Verb RunAs
exit
}
Write-Host "Running $strScriptName"
Write-Host "with Admin Privileges"
Read-Host "PRESS ENTER"
}
}
RestartScriptInElevatedModeOnWindows7
Function IsNumeric
# call like this:
# if ((IsNumeric $myVal) -eq $true )
{Param ( $strValueToTest )
[reflection.assembly]::LoadWithPartialName("'Microsoft.VisualBasic")
if ([Microsoft.VisualBasic.Information]::isnumeric($strValueToTest))
{return $True}
else
{return $False}
}
function InitializeAllFields {
DisableAllButtons
$dataGridProcesses.DataSource = $null
$dataGridServices.DataSource = $null
$dataGridEvents.DataSource = $null
$richTextBoxNetworkDetails.Text = ""
$textBoxLastReboot.Text = ""
EnableTheRightButtons
}
function DisableAllButtons {
$buttonGetDeviants.Enabled = $false
$buttonGetEvents.Enabled = $false
$buttonGetProcesses.Enabled = $false
$buttonGetServices.Enabled = $false
$buttonStartService.Enabled = $false
$buttonStopService.Enabled = $false
$buttonChangeStartModeToDisabled.Enabled = $false
$buttonChangeStartModeToAuto.Enabled = $false
$buttonChangeStartModeToManual.Enabled = $false
}
function EnableTheRightButtons {
$buttonGetDeviants.Enabled = $true
$buttonGetEvents.Enabled = $true
$buttonGetProcesses.Enabled = $true
$buttonGetServices.Enabled = $true
}
Function out-DataTable
{Param(
[ref]$thisDatatable,
[bool]$IsFirstCall = $false,
[hashtable]$StronglyTypedColumns
)
foreach ($item in $input){
$DR = $thisDatatable.Value.NewRow()
$Item.PsObject.get_properties() | foreach {
if ($IsFirstCall) {
if ($StronglyTypedColumns -is [hashtable])
{
$strColumnName = $_.Name.ToString()
if ($StronglyTypedColumns.ContainsKey($strColumnName))
{
$strDataType = ($StronglyTypedColumns.Item($strColumnName)).GetType()
# Write-Host "===> $strDataType"
# $Col = New-Object "System.Data.DataColumn" ($_.Name.ToString(), [int32])
$Col = New-Object "System.Data.DataColumn" ($strColumnName,$strDataType)
}
else
{ $Col = new-object Data.DataColumn }
}
else
{ $Col = new-object Data.DataColumn }
$Col.ColumnName = $_.Name.ToString()
$thisDatatable.Value.Columns.Add($Col)
# dit werkt hier niet: $thisDatatable.Value.Columns["ProcessId"].DefaultCellStyle.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleRight
}
if ($_.value -eq $null) {
$DR.Item($_.Name) = "[empty]"
}
elseif ($_.IsArray) {
$DR.Item($_.Name) =[string]::Join($_.value ,";")
}
else {
$DR.Item($_.Name) = $($_.value)
}
}
$thisDatatable.Value.Rows.Add($DR)
$IsFirstCall = $false
}
return @(,($thisDatatable.Value))
}
Function DisplayDatatableInDatagridview
{Param(
[ref]$thisDatatable,
[ref]$thisDatagrid,
[hashtable]$ColumnsToRightAlign
)
$thisDatagrid.Value.DataSource = $thisDatatable.Value.psObject.baseobject
$thisDatagrid.Value.AutoResizeColumns()
$iRowsFound = $thisDatagrid.Value.RowCount
if ($iRowsFound -gt 0)
{
if ($ColumnsToRightAlign -is [hashtable])
{
$ColumnsToRightAlign.GetEnumerator() | ForEach-Object {$thisDatagrid.Value.Columns[$_.Key].DefaultCellStyle.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleRight}
}
}
$statusBar1.Text = "found $iRowsFound items with this selection"
# return @(,($thisDatatable.Value))
}
$handler_buttonGetDeviants_Click={
DisableAllButtons
$DT = new-object Data.datatable
$ScriptBlock={( Get-WmiObject win32_service -ComputerName $strComputer | Where-Object { ($_.StartMode -eq "Auto" -and $_.State -ne "Running") -or ($_.StartMode -eq "Disabled" -and $_.State -ne "Stopped") } | Select DisplayName,Name,StartMode,State,AcceptPause,AcceptStop | sort -Property DisplayName )}
$dt = (&$scriptBlock | out-DataTable ([ref]$dt) -IsFirstCall $true )
DisplayDatatableInDatagridview ([ref]$dt) ([ref]$dataGridServices)
EnableTheRightButtons
}
function StopOrStartService
{Param(
$strStopOrStart,
$thisServiceName
)
DisableAllButtons
$strFilter = "Name='"+$thisServiceName+"'"
$strMethod = $strStopOrStart + "Service"
(Get-WmiObject -computer $strComputer Win32_Service -Filter $strFilter).InvokeMethod($strMethod,$null)
if ( $? )
{ $strMessage = "$strMethod $strServiceName: OK" }
else
{ $strMessage = "$strMethod $strServiceName: failed" }
Invoke-Command $handler_buttonGetServices_Click
$statusBar1.Text = $strMessage
EnableTheRightButtons
}
function ChangeServiceStartMode
{Param(
$thisServiceName,
$strChangeTo
)
DisableAllButtons
$strFilter = "Name='"+$thisServiceName+"'"
# Write-Host $strFilter
# Write-Host $strChangeTo
(Get-WmiObject -computer $strComputer Win32_Service -Filter $strFilter).ChangeStartMode($strChangeTo)
if ( $? )
{ $strMessage = "setting Startmode of $thisServiceName to $strChangeTo`: OK" }
else
{ $strMessage = "setting Startmode of $thisServiceName to $strChangeTo`: failed" }
Invoke-Command $handler_buttonGetServices_Click
$statusBar1.Text = $strMessage
EnableTheRightButtons
}
$handler_buttonStartService_Click={
$strKey = "Name"
$strAction = "Start"
$iKeyColumnIndex = GetColumnIndex ([ref]$strKey) ([ref]$dataGridServices)
$strServiceName = $dataGridServices.SelectedRows[0].Cells[$iKeyColumnIndex].Value
if (AreYouSureYouWantTo "$strAction service $strServiceName" )
{ StopOrStartService $strAction $strServiceName }
}
$handler_buttonStopService_Click={
$strKey = "Name"
$strAction = "Stop"
$iKeyColumnIndex = GetColumnIndex ([ref]$strKey) ([ref]$dataGridServices)
$strServiceName = $dataGridServices.SelectedRows[0].Cells[$iKeyColumnIndex].Value
if (AreYouSureYouWantTo "$strAction service $strServiceName" )
{ StopOrStartService $strAction $strServiceName }
}
$handler_buttonGetServices_Click={
DisableAllButtons
$DT = new-object Data.datatable
$ScriptBlock={( Get-WmiObject win32_service -ComputerName $strComputer | Select DisplayName,Name,StartMode,State,AcceptStop | sort -Property DisplayName )}
$dt = (&$scriptBlock | out-DataTable ([ref]$dt) -IsFirstCall $true )
DisplayDatatableInDatagridview ([ref]$dt) ([ref]$dataGridServices)
EnableTheRightButtons
}
$handler_buttonGetEvents_Click={
DisableAllButtons
$SWbemDateTime = New-Object -com WbemScripting.SWbemDateTime
if ($radioButtonApplicationOrSystem.Checked) {$strEventlog = "Application"}
if ($radioButtonApplicationOrSystem2.Checked) {$strEventlog = "System"}
$strSelect = "Select * from win32_ntlogevent where logfile='$strEventlog' and (EventType <> 0 AND EventType <> 3)"
if ($radioButtonDateOrNrOfErrors.Checked) #use startdate
{
$UTC_Offset = 0
$dtStartDate = (Get-Date $dateTimePicker1.Value).AddHours($UTC_Offset)
$dtStartDate = (Get-Date -Date $dtStartDate -Hour 0 -Minute 0 -Second 0)
$dtBeginDate=[System.Management.ManagementDateTimeConverter]::ToDMTFDateTime($dtStartDate)
$strSelect = "$strSelect AND TimeWritten >='$dtBeginDate'"
$ScriptBlock={(Get-WmiObject -computername $strComputer -query $strSelect | Select -property Type,@{Name='TimeWritten' ; Expression={$SWbemDateTime.Value = $_.TimeWritten ; $SWbemDateTime.GetVarDate($True)}},EventCode,SourceName,User,Message )}
}
elseif ($radioButtonDateOrNrOfErrors2.Checked) #use last X
{
$ScriptBlock={(Get-WmiObject -computername $strComputer -query $strSelect | Select -first $numericUpDownLast_X_Errors.Text -property Type,@{Name='TimeWritten' ; Expression={$SWbemDateTime.Value = $_.TimeWritten ; $SWbemDateTime.GetVarDate($True)}},EventCode,SourceName,User,Message )}
}
$DT = new-object Data.datatable
$StronglyTypedColumns = @{"EventCode" = 123 ; "TimeWritten" = Get-Date }
$ColumnsToAlignRight = @{"EventCode" = 123 }
$dt = (&$scriptBlock | out-DataTable ([ref]$dt) -IsFirstCall $true -StronglyTypedColumns $StronglyTypedColumns )
DisplayDatatableInDatagridview ([ref]$dt) ([ref]$dataGridEvents) -ColumnsToRightAlign $ColumnsToAlignRight
EnableTheRightButtons
}
$handler_radioButtonDateOrNrOfErrors_Click={
# Write-Host $dateTimePicker1.Value
if ($dateTimePicker1.Value -eq "1-1-2010 11:11:00")
{
$dateTimePicker1.Value = Get-Date (Get-Date -Format dd-MM-yyyy)
}
if ($radioButtonDateOrNrOfErrors.Checked)
{
$dateTimePicker1.Enabled = $true
$numericUpDownLast_X_Errors.Enabled = $false
}
else
{
$dateTimePicker1.Enabled = $false
$numericUpDownLast_X_Errors.Enabled = $true
}
}
$handler_form1_Load={
$textBoxComputername.Text = $env:computername
$strComputer = $textBoxComputername.Text
InitializeAllFields
}
$handler_tooltipGetDeviants_Popup=[System.Windows.Forms.PopupEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.PopupEventArgs]
#TODO: Place custom script here
}
$handler_textBoxComputername_Leave={
if ($textBoxComputername.Text -eq "")
{
$textBoxComputername.Text = $env:computername
}
if ($strComputer -ne $textBoxComputername.Text)
{
InitializeAllFields
$strComputer = $textBoxComputername.Text
}
}
function GetColumnIndex
{Param(
[ref]$thisColumnName,
[ref]$thisDataTable
)
$iColumnCount = $thisDataTable.Value.ColumnCount
for ($i = 0 ; $i -lt $iColumnCount ; $i++)
{
if ( $thisDataTable.Value.Columns[$i].Name -eq $thisColumnName.Value )
{ return $i}
}
return -1
}
$handler_buttonStopProcess_Click={
if ( $dataGridProcesses.SelectedRows.Count -ne 1)
{
$objPopup = New-Object -comobject Wscript.Shell
$iAnswer = $objPopup.Popup("please select 1 process", 0,"Select process to kill",0)
}
else
{
$strKey = "ProcessId"
$strName = "Name"
$iKeyColumnIndex = GetColumnIndex ([ref]$strKey) ([ref]$dataGridProcesses)
$iNameColumnIndex = GetColumnIndex ([ref]$strName) ([ref]$dataGridProcesses)
$iProcessId = $dataGridProcesses.SelectedRows[0].Cells[$iKeyColumnIndex].Value
$strProcessName = $dataGridProcesses.SelectedRows[0].Cells[$iNameColumnIndex].Value
if (AreYouSureYouWantTo "kill process $strProcessName with ProcessId $iProcessId" )
{
$strSelect = "select * from win32_process where ProcessId='$iProcessId'"
Write-Host $strSelect
$objProcessToKill = Get-WmiObject -ComputerName $strComputer -query $strSelect
$objProcessToKill.Terminate()
Invoke-Command $handler_buttonGetProcesses_Click
}
}
}
$handler_buttonGetProcesses_Click={
# $arrProcesses = New-Object System.Collections.ArrayList
## $Script:procInfo = Get-Process -ComputerName $strComputer | Select Id,Name,Path,Description,VM,WS,CPU,Company | sort -Property Name
# $Script:procInfo = Get-WmiObject Win32_Process -ComputerName $strComputer | Select ProcessId,Name,Path,Description,VM,WS,Handles,PeakVirtualSize | sort -Property Name
# $arrProcesses.AddRange($procInfo)
# $dataGridProcesses.DataSource = $arrProcesses
# $formulier.refresh()
# @{Name='PeakVirtualSize' ; Expression={"{0:N0}" -f $_.PeakVirtualSize}}
$DT = new-object Data.datatable
$ScriptBlock={( Get-WmiObject Win32_Process -ComputerName $strComputer | Select ProcessId,Name,Path,VM,WS,Handles,PeakVirtualSize | sort -Property Name )}
$StronglyTypedColumns = @{"ProcessId" = 123;"VM" = 123456789;"WS" = 123456789;"Handles" = 1234;"PeakVirtualSize" = 123456789}
$dt = (&$scriptBlock | out-DataTable ([ref]$dt) -IsFirstCall $true -StronglyTypedColumns $StronglyTypedColumns )
DisplayDatatableInDatagridview ([ref]$dt) ([ref]$dataGridProcesses) -ColumnsToRightAlign $StronglyTypedColumns
}
$handler_buttonGetNICs_Click={
$richTextBoxNetworkDetails.Clear()
$strSelect = "SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled = 'True'"
$NICDetails = @(Get-WmiObject -ComputerName $strComputer -query $strSelect) #force array
$temp = ""
for ($i = 0 ; $i -lt $NICDetails.Count ; $i++)
{
# $NICDetails | ForEach-Object {
$temp = $temp + "Caption : " + $($NICDetails[$i].Caption) + "`n"
$temp = $temp + "DefaultIPGateway : " + $($NICDetails[$i].DefaultIPGateway) + "`n"
$temp = $temp + "Description : " + $($NICDetails[$i].Description) + "`n"
$temp = $temp + "DHCPEnabled : " + $($NICDetails[$i].DHCPEnabled) + "`n"
$temp = $temp + "DHCPServer : " + $($NICDetails[$i].DHCPServer) + "`n"
$temp = $temp + "DNSDomain : " + $($NICDetails[$i].DNSDomain) + "`n"
$temp = $temp + "DNSDomainSuffixSearchOrder : " + $($NICDetails[$i].DNSDomainSuffixSearchOrder) + "`n"
$temp = $temp + "DNSEnabledForWINSResolution : " + $($NICDetails[$i].DNSEnabledForWINSResolution) + "`n"
$temp = $temp + "DNSHostName : " + $($NICDetails[$i].DNSHostName) + "`n"
$temp = $temp + "DNSServerSearchOrder : " + $($NICDetails[$i].DNSServerSearchOrder) + "`n"
$temp = $temp + "DomainDNSRegistrationEnabled: " + $($NICDetails[$i].DomainDNSRegistrationEnabled) + "`n"
$temp = $temp + "IPAddress : " + $($NICDetails[$i].IPAddress) + "`n"
$temp = $temp + "IPSubnet : " + $($NICDetails[$i].IPSubnet) + "`n"
$temp = $temp + "MACAddress : " + $($NICDetails[$i].MACAddress) + "`n"
$temp = $temp + "WINSEnableLMHostsLookup : " + $($NICDetails[$i].WINSEnableLMHostsLookup) + "`n"
$temp = $temp + "WINSHostLookupFile : " + $($NICDetails[$i].WINSHostLookupFile) + "`n"
$temp = $temp + "WINSPrimaryServer : " + $($NICDetails[$i].WINSPrimaryServer) + "`n"
$temp = $temp + "WINSSecondaryServer : " + $($NICDetails[$i].WINSSecondaryServer) + "`n" + "`n" + "`n"
}
$richTextBoxNetworkDetails.AppendText($temp)
#Get-WmiObject -ComputerName $strComputer -query $strSelect | select Caption,DefaultIPGateway,Description,IPAddress,IPSubnet,MACAddress,WINSPrimaryServer,WINSSecondaryServer | ConvertTo-Html -as list | out-file c:\temp\test.html
}
$handler_datagridServices_RowEnter={
if ($dataGridServices.DataSource -eq $null)
{
$strSelectedServiceName = ""
$buttonStartService.Enabled = $false
$buttonStopService.Enabled = $false
$buttonChangeStartModeToDisabled.Enabled = $false
$buttonChangeStartModeToAuto.Enabled = $false
$buttonChangeStartModeToManual = $false
}
else
{
$strKey = "Name"
$strKeyStartMode = "StartMode"
$strKeyState = "State"
$iKeyColumnIndex = GetColumnIndex ([ref]$strKey) ([ref]$dataGridServices)
$iStartModeColumnIndex = GetColumnIndex ([ref]$strKeyStartMode) ([ref]$dataGridServices)
$iStateColumnIndex = GetColumnIndex ([ref]$strKeyState) ([ref]$dataGridServices)
if (($iKeyColumnIndex -eq -1) -or ($iStartModeColumnIndex -eq -1) -or ($iStateColumnIndex -eq -1))
{
Write-Host "required column $strKey or $strKeyStartMode or $strKeyState could not be detected"
}
else
{
if ($dataGridServices.SelectedRows.Count -gt 0)
{
$strStartMode = $dataGridServices.SelectedRows[0].Cells[$iStartModeColumnIndex].Value
$strState = $dataGridServices.SelectedRows[0].Cells[$iStateColumnIndex].Value
$strServiceName = $dataGridServices.SelectedRows[0].Cells[$iKeyColumnIndex].Value
Switch($strStartMode){
{ $_ -eq "Disabled" } {
$buttonChangeStartModeToDisabled.Enabled = $false
$buttonChangeStartModeToAuto.Enabled = $true
$buttonChangeStartModeToManual.Enabled = $true
break }
{ $_ -eq "Auto" } {
$buttonChangeStartModeToDisabled.Enabled = $true
$buttonChangeStartModeToAuto.Enabled = $false
$buttonChangeStartModeToManual.Enabled = $true
break }
{ $_ -eq "Manual" } {
$buttonChangeStartModeToDisabled.Enabled = $true
$buttonChangeStartModeToAuto.Enabled = $true
$buttonChangeStartModeToManual.Enabled = $false
break }
}
Switch($strState){
{ $_ -eq "Running" } {
$buttonStartService.Enabled = $false
$buttonStopService.Enabled = $true
break }
{ $_ -eq "Stopped" } {
$buttonStartService.Enabled = $true
$buttonStopService.Enabled = $false
break }
Default {
$buttonStartService.Enabled = $true
$buttonStopService.Enabled = $true
}
}
}
}
}
}
function AreYouSureYouWantTo
{Param( $thisMessage, $thisTitle )
$objPopup = New-Object -comobject Wscript.Shell
$iAnswer = $objPopup.Popup("Are you sure you want to $thisMessage", 0,$thisTitle,3)
If ($iAnswer -eq 6) { #$popup.popup("You answered yes.")
return $true
}
else {
return $false
}
}
$handler_buttonChangeStartModeToDisabled_Click={
$strKey = "Name"
$strMode = "Disabled"
$iKeyColumnIndex = GetColumnIndex ([ref]$strKey) ([ref]$dataGridServices)
$strServiceName = $dataGridServices.SelectedRows[0].Cells[$iKeyColumnIndex].Value
if (AreYouSureYouWantTo "change StartMode of $strServiceName to $strMode" )
{ ChangeServiceStartMode $strServiceName $strMode }
}
$handler_buttonChangeStartModeToAuto_Click={
$strKey = "Name"
$strMode = "Automatic"
$iKeyColumnIndex = GetColumnIndex ([ref]$strKey) ([ref]$dataGridServices)
$strServiceName = $dataGridServices.SelectedRows[0].Cells[$iKeyColumnIndex].Value
if (AreYouSureYouWantTo "change StartMode of $strServiceName to $strMode" )
{ ChangeServiceStartMode $strServiceName $strMode }
}
$handler_buttonChangeStartModeToManual_Click={
$strKey = "Name"
$strMode = "Manual"
$iKeyColumnIndex = GetColumnIndex ([ref]$strKey) ([ref]$dataGridServices)
$strServiceName = $dataGridServices.SelectedRows[0].Cells[$iKeyColumnIndex].Value
if (AreYouSureYouWantTo "change StartMode of $strServiceName to $strMode" )
{ ChangeServiceStartMode $strServiceName $strMode }
}
$handler_buttonLastReboot_Enter={
$SWbemDateTime = New-Object -com WbemScripting.SWbemDateTime
$z = get-wmiobject Win32_OperatingSystem -computername $strComputer
$textBoxLastReboot.Text = ""
foreach ($k in $z)
{$SWbemDateTime.value = $k.lastBootupTime #get lastBootupTime
# If (($k.Version -eq "5.2.3790" ) -or ($k.Version -eq "6.1.7600" ))
# {
$textBoxLastReboot.Text = $SWbemDateTime.GetVarDate($True)
# } #convert to localtime
# Else { $textBoxLastReboot.Text = $SWbemDateTime.GetVarDate($False) } #do NOT convert to localtime
}
}
# --End User Generated Script--
#----------------------------------------------
# Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$formulier.WindowState = $InitialFormWindowState
}
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
#
# formulier
#
$formulier.Controls.Add($groupboxLastReboot)
$formulier.Controls.Add($groupBoxComputer)
$formulier.Controls.Add($statusBar1)
$formulier.Controls.Add($tabControl1)
$formulier.BackColor = [System.Drawing.Color]::FromArgb(255,227,227,227)
$formulier.ClientSize = New-Object System.Drawing.Size(853,730)
$formulier.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$formulier.MaximizeBox = $False
$formulier.Name = "formulier"
$formulier.Text = "Get computer info"
$formulier.add_Load($handler_form1_Load)
#
# groupboxLastReboot
#
$groupboxLastReboot.Controls.Add($buttonLastReboot)
$groupboxLastReboot.Controls.Add($textBoxLastReboot)
$groupboxLastReboot.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupboxLastReboot.Location = New-Object System.Drawing.Point(506,2)
$groupboxLastReboot.Name = "groupboxLastReboot"
$groupboxLastReboot.Size = New-Object System.Drawing.Size(267,39)
$groupboxLastReboot.TabIndex = 9
$groupboxLastReboot.TabStop = $False
$groupboxLastReboot.Text = "last bootup"
#
# buttonLastReboot
#
$buttonLastReboot.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonLastReboot.Location = New-Object System.Drawing.Point(165,12)
$buttonLastReboot.Name = "buttonLastReboot"
$buttonLastReboot.Size = New-Object System.Drawing.Size(75,23)
$buttonLastReboot.TabIndex = 2
$buttonLastReboot.Text = "Check"
$buttonLastReboot.UseVisualStyleBackColor = $True
$buttonLastReboot.add_Enter($handler_buttonLastReboot_Enter)
#
# textBoxLastReboot
#
$textBoxLastReboot.AutoCompleteMode = [System.Windows.Forms.AutoCompleteMode]::Suggest
$textBoxLastReboot.AutoCompleteSource = [System.Windows.Forms.AutoCompleteSource]::AllSystemSources
$textBoxLastReboot.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$textBoxLastReboot.Location = New-Object System.Drawing.Point(9,14)
$textBoxLastReboot.Name = "textBoxLastReboot"
$textBoxLastReboot.Size = New-Object System.Drawing.Size(150,20)
$textBoxLastReboot.TabIndex = 1
#
# groupBoxComputer
#
$groupBoxComputer.Controls.Add($textBoxComputername)
$groupBoxComputer.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupBoxComputer.Location = New-Object System.Drawing.Point(300,2)
$groupBoxComputer.Name = "groupBoxComputer"
$groupBoxComputer.Size = New-Object System.Drawing.Size(142,39)
$groupBoxComputer.TabIndex = 8
$groupBoxComputer.TabStop = $False
$groupBoxComputer.Text = "computer"
#
# textBoxComputername
#
$textBoxComputername.AutoCompleteMode = [System.Windows.Forms.AutoCompleteMode]::Suggest
$textBoxComputername.AutoCompleteSource = [System.Windows.Forms.AutoCompleteSource]::AllSystemSources
$textBoxComputername.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$textBoxComputername.Location = New-Object System.Drawing.Point(9,14)
$textBoxComputername.Name = "textBoxComputername"
$textBoxComputername.Size = New-Object System.Drawing.Size(100,20)
$textBoxComputername.TabIndex = 1
$textBoxComputername.add_Leave($handler_textBoxComputername_Leave)
#
# statusBar1
#
$statusBar1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$statusBar1.Location = New-Object System.Drawing.Point(0,708)
$statusBar1.Name = "statusBar1"
$statusBar1.Size = New-Object System.Drawing.Size(853,22)
$statusBar1.SizingGrip = $False
$statusBar1.TabIndex = 6
$statusBar1.Text = "Ready."
#
# tabControl1
#
$tabControl1.Controls.Add($tabPage1)
$tabControl1.Controls.Add($tabPage2)
$tabControl1.Controls.Add($tabPage3)
$tabControl1.Controls.Add($tabPage4)
$tabControl1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tabControl1.Location = New-Object System.Drawing.Point(12,26)
$tabControl1.Name = "tabControl1"
$tabControl1.SelectedIndex = 0
$tabControl1.Size = New-Object System.Drawing.Size(829,676)
$tabControl1.TabIndex = 7
#
# tabPage1
#
$tabPage1.Controls.Add($groupboxGetDeviants)
$tabPage1.Controls.Add($groupboxGetServices)
$tabPage1.Controls.Add($groupboxStopStartService)
$tabPage1.Controls.Add($groupboxChangeStartMode)
$tabPage1.Controls.Add($datagridServices)
$tabPage1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tabPage1.Location = New-Object System.Drawing.Point(4,22)
$tabPage1.Name = "tabPage1"
$System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding
$System_Windows_Forms_Padding.All = 3
$System_Windows_Forms_Padding.Bottom = 3
$System_Windows_Forms_Padding.Left = 3
$System_Windows_Forms_Padding.Right = 3
$System_Windows_Forms_Padding.Top = 3
$tabPage1.Padding = $System_Windows_Forms_Padding
$tabPage1.Size = New-Object System.Drawing.Size(821,650)
$tabPage1.TabIndex = 0
$tabPage1.Text = "Services"
$tabPage1.UseVisualStyleBackColor = $True
#
# groupboxGetDeviants
#
$groupboxGetDeviants.Controls.Add($buttonGetDeviants)
$groupboxGetDeviants.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupboxGetDeviants.Location = New-Object System.Drawing.Point(161,6)
$groupboxGetDeviants.Name = "groupboxGetDeviants"
$groupboxGetDeviants.Size = New-Object System.Drawing.Size(172,43)
$groupboxGetDeviants.TabIndex = 15
$groupboxGetDeviants.TabStop = $False
$groupboxGetDeviants.Text = "Auto/stopped Disabled/running"
#
# buttonGetDeviants
#
$buttonGetDeviants.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonGetDeviants.Location = New-Object System.Drawing.Point(6,14)
$buttonGetDeviants.Name = "buttonGetDeviants"
$buttonGetDeviants.Size = New-Object System.Drawing.Size(75,23)
$buttonGetDeviants.TabIndex = 6
$buttonGetDeviants.Text = "GetDeviants"
$buttonGetDeviants.UseVisualStyleBackColor = $True
$buttonGetDeviants.add_Click($handler_buttonGetDeviants_Click)
#
# groupboxGetServices
#
$groupboxGetServices.Controls.Add($buttonGetServices)
$groupboxGetServices.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupboxGetServices.Location = New-Object System.Drawing.Point(8,6)
$groupboxGetServices.Name = "groupboxGetServices"
$groupboxGetServices.Size = New-Object System.Drawing.Size(147,43)
$groupboxGetServices.TabIndex = 14
$groupboxGetServices.TabStop = $False
$groupboxGetServices.Text = "Get all services"
#
# buttonGetServices
#
$buttonGetServices.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonGetServices.Location = New-Object System.Drawing.Point(6,14)
$buttonGetServices.Name = "buttonGetServices"
$buttonGetServices.Size = New-Object System.Drawing.Size(75,23)
$buttonGetServices.TabIndex = 2
$buttonGetServices.Text = "GetServices"
$buttonGetServices.UseVisualStyleBackColor = $True
$buttonGetServices.add_Click($handler_buttonGetServices_Click)
#
# groupboxStopStartService
#
$groupboxStopStartService.Controls.Add($buttonStartService)
$groupboxStopStartService.Controls.Add($buttonStopService)
$groupboxStopStartService.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupboxStopStartService.Location = New-Object System.Drawing.Point(339,6)
$groupboxStopStartService.Name = "groupboxStopStartService"
$groupboxStopStartService.Size = New-Object System.Drawing.Size(173,43)
$groupboxStopStartService.TabIndex = 13
$groupboxStopStartService.TabStop = $False
$groupboxStopStartService.Text = "Stop/Start service"
#
# buttonStartService
#
$buttonStartService.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonStartService.Enabled = $False
$buttonStartService.Location = New-Object System.Drawing.Point(92,14)
$buttonStartService.Name = "buttonStartService"
$buttonStartService.Size = New-Object System.Drawing.Size(75,23)
$buttonStartService.TabIndex = 5
$buttonStartService.Text = "Start"
$buttonStartService.UseVisualStyleBackColor = $True
$buttonStartService.add_Click($handler_buttonStartService_Click)
#
# buttonStopService
#
$buttonStopService.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonStopService.Enabled = $False
$buttonStopService.Location = New-Object System.Drawing.Point(11,14)
$buttonStopService.Name = "buttonStopService"
$buttonStopService.Size = New-Object System.Drawing.Size(75,23)
$buttonStopService.TabIndex = 4
$buttonStopService.Text = "Stop"
$buttonStopService.UseVisualStyleBackColor = $True
$buttonStopService.add_Click($handler_buttonStopService_Click)
#
# groupboxChangeStartMode
#
$groupboxChangeStartMode.Controls.Add($buttonChangeStartModeToManual)
$groupboxChangeStartMode.Controls.Add($buttonChangeStartModeToDisabled)
$groupboxChangeStartMode.Controls.Add($buttonChangeStartModeToAuto)
$groupboxChangeStartMode.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupboxChangeStartMode.Location = New-Object System.Drawing.Point(549,5)
$groupboxChangeStartMode.Name = "groupboxChangeStartMode"
$groupboxChangeStartMode.Size = New-Object System.Drawing.Size(259,44)
$groupboxChangeStartMode.TabIndex = 12
$groupboxChangeStartMode.TabStop = $False
$groupboxChangeStartMode.Text = "ChangeStartModeTo"
#
# buttonChangeStartModeToManual
#
$buttonChangeStartModeToManual.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonChangeStartModeToManual.Location = New-Object System.Drawing.Point(173,15)
$buttonChangeStartModeToManual.Name = "buttonChangeStartModeToManual"
$buttonChangeStartModeToManual.Size = New-Object System.Drawing.Size(75,23)
$buttonChangeStartModeToManual.TabIndex = 12
$buttonChangeStartModeToManual.Text = "Manual"
$buttonChangeStartModeToManual.UseVisualStyleBackColor = $True
$buttonChangeStartModeToManual.add_Click($handler_buttonChangeStartModeToManual_Click)
#
# buttonChangeStartModeToDisabled
#
$buttonChangeStartModeToDisabled.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonChangeStartModeToDisabled.Location = New-Object System.Drawing.Point(11,15)
$buttonChangeStartModeToDisabled.Name = "buttonChangeStartModeToDisabled"
$buttonChangeStartModeToDisabled.Size = New-Object System.Drawing.Size(75,23)
$buttonChangeStartModeToDisabled.TabIndex = 10
$buttonChangeStartModeToDisabled.Text = "Disable"
$buttonChangeStartModeToDisabled.UseVisualStyleBackColor = $True
$buttonChangeStartModeToDisabled.add_Click($handler_buttonChangeStartModeToDisabled_Click)
#
# buttonChangeStartModeToAuto
#
$buttonChangeStartModeToAuto.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonChangeStartModeToAuto.Location = New-Object System.Drawing.Point(92,15)
$buttonChangeStartModeToAuto.Name = "buttonChangeStartModeToAuto"
$buttonChangeStartModeToAuto.Size = New-Object System.Drawing.Size(75,23)
$buttonChangeStartModeToAuto.TabIndex = 11
$buttonChangeStartModeToAuto.Text = "Auto"
$buttonChangeStartModeToAuto.UseVisualStyleBackColor = $True
$buttonChangeStartModeToAuto.add_Click($handler_buttonChangeStartModeToAuto_Click)
#
# datagridServices
#
$datagridServices.AllowUserToAddRows = $False
$datagridServices.AllowUserToDeleteRows = $False
$datagridServices.AllowUserToOrderColumns = $True
$System_Windows_Forms_DataGridViewCellStyle_46 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_46.BackColor = [System.Drawing.Color]::FromArgb(255,250,250,210)
$datagridServices.AlternatingRowsDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_46
$System_Windows_Forms_DataGridViewCellStyle_47 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_47.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
$System_Windows_Forms_DataGridViewCellStyle_47.BackColor = [System.Drawing.Color]::FromArgb(255,240,230,140)
$System_Windows_Forms_DataGridViewCellStyle_47.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,0,3,1)
$System_Windows_Forms_DataGridViewCellStyle_47.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$System_Windows_Forms_DataGridViewCellStyle_47.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
$System_Windows_Forms_DataGridViewCellStyle_47.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_47.WrapMode = [System.Windows.Forms.DataGridViewTriState]::True
$datagridServices.ColumnHeadersDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_47
$datagridServices.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$System_Windows_Forms_DataGridViewCellStyle_48 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_48.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
$System_Windows_Forms_DataGridViewCellStyle_48.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_48.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,0,3,1)
$System_Windows_Forms_DataGridViewCellStyle_48.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$System_Windows_Forms_DataGridViewCellStyle_48.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
$System_Windows_Forms_DataGridViewCellStyle_48.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_48.WrapMode = [System.Windows.Forms.DataGridViewTriState]::False
$datagridServices.DefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_48
$datagridServices.EnableHeadersVisualStyles = $False
$datagridServices.Location = New-Object System.Drawing.Point(7,55)
$datagridServices.MultiSelect = $False
$datagridServices.Name = "datagridServices"
$datagridServices.ReadOnly = $True
$System_Windows_Forms_DataGridViewCellStyle_49 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_49.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
$System_Windows_Forms_DataGridViewCellStyle_49.BackColor = [System.Drawing.Color]::FromArgb(255,240,240,240)
$System_Windows_Forms_DataGridViewCellStyle_49.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,0,3,1)
$System_Windows_Forms_DataGridViewCellStyle_49.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$System_Windows_Forms_DataGridViewCellStyle_49.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
$System_Windows_Forms_DataGridViewCellStyle_49.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_49.WrapMode = [System.Windows.Forms.DataGridViewTriState]::True
$datagridServices.RowHeadersDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_49
$datagridServices.RowHeadersVisible = $False
$System_Windows_Forms_DataGridViewCellStyle_50 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_50.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_50.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$datagridServices.RowsDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_50
$datagridServices.SelectionMode = [System.Windows.Forms.DataGridViewSelectionMode]::FullRowSelect
$datagridServices.Size = New-Object System.Drawing.Size(807,589)
$datagridServices.TabIndex = 9
$datagridServices.add_RowEnter($handler_datagridServices_RowEnter)
#
# tabPage2
#
$tabPage2.Controls.Add($datagridEvents)
$tabPage2.Controls.Add($buttonGetEvents)
$tabPage2.Controls.Add($groupBox3)
$tabPage2.Controls.Add($groupBox2)
$tabPage2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tabPage2.Location = New-Object System.Drawing.Point(4,22)
$tabPage2.Name = "tabPage2"
$System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding
$System_Windows_Forms_Padding.All = 3
$System_Windows_Forms_Padding.Bottom = 3
$System_Windows_Forms_Padding.Left = 3
$System_Windows_Forms_Padding.Right = 3
$System_Windows_Forms_Padding.Top = 3
$tabPage2.Padding = $System_Windows_Forms_Padding
$tabPage2.Size = New-Object System.Drawing.Size(821,650)
$tabPage2.TabIndex = 1
$tabPage2.Text = "EventLogs"
$tabPage2.UseVisualStyleBackColor = $True
#
# datagridEvents
#
$datagridEvents.AllowUserToAddRows = $False
$datagridEvents.AllowUserToDeleteRows = $False
$datagridEvents.AllowUserToOrderColumns = $True
$System_Windows_Forms_DataGridViewCellStyle_51 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_51.BackColor = [System.Drawing.Color]::FromArgb(255,250,250,210)
$datagridEvents.AlternatingRowsDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_51
$datagridEvents.AutoSizeRowsMode = [System.Windows.Forms.DataGridViewAutoSizeRowsMode]::AllCells
$System_Windows_Forms_DataGridViewCellStyle_52 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_52.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
$System_Windows_Forms_DataGridViewCellStyle_52.BackColor = [System.Drawing.Color]::FromArgb(255,240,230,140)
$System_Windows_Forms_DataGridViewCellStyle_52.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,0,3,1)
$System_Windows_Forms_DataGridViewCellStyle_52.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$System_Windows_Forms_DataGridViewCellStyle_52.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
$System_Windows_Forms_DataGridViewCellStyle_52.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_52.WrapMode = [System.Windows.Forms.DataGridViewTriState]::True
$datagridEvents.ColumnHeadersDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_52
$datagridEvents.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$System_Windows_Forms_DataGridViewCellStyle_53 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_53.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
$System_Windows_Forms_DataGridViewCellStyle_53.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_53.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,0,3,1)
$System_Windows_Forms_DataGridViewCellStyle_53.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$System_Windows_Forms_DataGridViewCellStyle_53.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
$System_Windows_Forms_DataGridViewCellStyle_53.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_53.WrapMode = [System.Windows.Forms.DataGridViewTriState]::True
$datagridEvents.DefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_53
$datagridEvents.EnableHeadersVisualStyles = $False
$datagridEvents.Location = New-Object System.Drawing.Point(6,69)
$datagridEvents.MultiSelect = $False
$datagridEvents.Name = "datagridEvents"
$datagridEvents.ReadOnly = $True
$System_Windows_Forms_DataGridViewCellStyle_54 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_54.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
$System_Windows_Forms_DataGridViewCellStyle_54.BackColor = [System.Drawing.Color]::FromArgb(255,240,240,240)
$System_Windows_Forms_DataGridViewCellStyle_54.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,0,3,1)
$System_Windows_Forms_DataGridViewCellStyle_54.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$System_Windows_Forms_DataGridViewCellStyle_54.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
$System_Windows_Forms_DataGridViewCellStyle_54.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_54.WrapMode = [System.Windows.Forms.DataGridViewTriState]::True
$datagridEvents.RowHeadersDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_54
$datagridEvents.RowHeadersVisible = $False
$System_Windows_Forms_DataGridViewCellStyle_55 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_55.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_55.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$datagridEvents.RowsDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_55
$datagridEvents.SelectionMode = [System.Windows.Forms.DataGridViewSelectionMode]::FullRowSelect
$datagridEvents.Size = New-Object System.Drawing.Size(812,575)
$datagridEvents.TabIndex = 11
#
# buttonGetEvents
#
$buttonGetEvents.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonGetEvents.Location = New-Object System.Drawing.Point(218,11)
$buttonGetEvents.Name = "buttonGetEvents"
$buttonGetEvents.Size = New-Object System.Drawing.Size(75,23)
$buttonGetEvents.TabIndex = 10
$buttonGetEvents.Text = "GetEvents"
$buttonGetEvents.UseVisualStyleBackColor = $True
$buttonGetEvents.add_Click($handler_buttonGetEvents_Click)
#
# groupBox3
#
$groupBox3.Controls.Add($radioButtonDateOrNrOfErrors2)
$groupBox3.Controls.Add($numericUpDownLast_X_Errors)
$groupBox3.Controls.Add($radioButtonDateOrNrOfErrors)
$groupBox3.Controls.Add($dateTimePicker1)
$groupBox3.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupBox3.Location = New-Object System.Drawing.Point(325,4)
$groupBox3.Name = "groupBox3"
$groupBox3.Size = New-Object System.Drawing.Size(288,57)
$groupBox3.TabIndex = 8
$groupBox3.TabStop = $False
#
# radioButtonDateOrNrOfErrors2
#
$radioButtonDateOrNrOfErrors2.Checked = $True
$radioButtonDateOrNrOfErrors2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$radioButtonDateOrNrOfErrors2.Location = New-Object System.Drawing.Point(7,28)
$radioButtonDateOrNrOfErrors2.Name = "radioButtonDateOrNrOfErrors2"
$radioButtonDateOrNrOfErrors2.Size = New-Object System.Drawing.Size(172,24)
$radioButtonDateOrNrOfErrors2.TabIndex = 7
$radioButtonDateOrNrOfErrors2.TabStop = $True
$radioButtonDateOrNrOfErrors2.Text = "last X errors/warnings"
$radioButtonDateOrNrOfErrors2.UseVisualStyleBackColor = $True
$radioButtonDateOrNrOfErrors2.add_Click($handler_radioButtonDateOrNrOfErrors_Click)
#
# numericUpDownLast_X_Errors
#
$numericUpDownLast_X_Errors.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$numericUpDownLast_X_Errors.Increment = 10
$numericUpDownLast_X_Errors.Location = New-Object System.Drawing.Point(225,32)
$numericUpDownLast_X_Errors.Maximum = 1000
$numericUpDownLast_X_Errors.Minimum = 10
$numericUpDownLast_X_Errors.Name = "numericUpDownLast_X_Errors"
$numericUpDownLast_X_Errors.Size = New-Object System.Drawing.Size(54,20)
$numericUpDownLast_X_Errors.TabIndex = 8
$numericUpDownLast_X_Errors.TextAlign = [System.Windows.Forms.HorizontalAlignment]::Center
$numericUpDownLast_X_Errors.Value = 10
#
# radioButtonDateOrNrOfErrors
#
$radioButtonDateOrNrOfErrors.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$radioButtonDateOrNrOfErrors.Location = New-Object System.Drawing.Point(7,8)
$radioButtonDateOrNrOfErrors.Name = "radioButtonDateOrNrOfErrors"
$radioButtonDateOrNrOfErrors.Size = New-Object System.Drawing.Size(66,24)
$radioButtonDateOrNrOfErrors.TabIndex = 6
$radioButtonDateOrNrOfErrors.Text = "startdate"
$radioButtonDateOrNrOfErrors.UseVisualStyleBackColor = $True
$radioButtonDateOrNrOfErrors.add_Click($handler_radioButtonDateOrNrOfErrors_Click)
#
# dateTimePicker1
#
$dateTimePicker1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$dateTimePicker1.Enabled = $False
$dateTimePicker1.Location = New-Object System.Drawing.Point(79,8)
$dateTimePicker1.MaxDate = "2022-12-31"
$dateTimePicker1.MinDate = "2010-01-01"
$dateTimePicker1.Name = "dateTimePicker1"
$dateTimePicker1.Size = New-Object System.Drawing.Size(200,20)
$dateTimePicker1.TabIndex = 0
$dateTimePicker1.Value = "01/01/2010 11:11:00"
#
# groupBox2
#
$groupBox2.Controls.Add($radioButtonApplicationOrSystem2)
$groupBox2.Controls.Add($radioButtonApplicationOrSystem)
$groupBox2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$groupBox2.Location = New-Object System.Drawing.Point(7,2)
$groupBox2.Name = "groupBox2"
$groupBox2.Size = New-Object System.Drawing.Size(205,38)
$groupBox2.TabIndex = 4
$groupBox2.TabStop = $False
$groupBox2.Text = "select eventlog"
#
# radioButtonApplicationOrSystem2
#
$radioButtonApplicationOrSystem2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$radioButtonApplicationOrSystem2.Location = New-Object System.Drawing.Point(107,12)
$radioButtonApplicationOrSystem2.Name = "radioButtonApplicationOrSystem2"
$radioButtonApplicationOrSystem2.Size = New-Object System.Drawing.Size(104,24)
$radioButtonApplicationOrSystem2.TabIndex = 5
$radioButtonApplicationOrSystem2.Text = "System"
$radioButtonApplicationOrSystem2.UseVisualStyleBackColor = $True
#
# radioButtonApplicationOrSystem
#
$radioButtonApplicationOrSystem.Checked = $True
$radioButtonApplicationOrSystem.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$radioButtonApplicationOrSystem.Location = New-Object System.Drawing.Point(7,12)
$radioButtonApplicationOrSystem.Name = "radioButtonApplicationOrSystem"
$radioButtonApplicationOrSystem.Size = New-Object System.Drawing.Size(104,24)
$radioButtonApplicationOrSystem.TabIndex = 4
$radioButtonApplicationOrSystem.TabStop = $True
$radioButtonApplicationOrSystem.Text = "Application"
$radioButtonApplicationOrSystem.UseVisualStyleBackColor = $True
#
# tabPage3
#
$tabPage3.Controls.Add($dataGridProcesses)
$tabPage3.Controls.Add($buttonStopProcess)
$tabPage3.Controls.Add($buttonGetProcesses)
$tabPage3.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tabPage3.Location = New-Object System.Drawing.Point(4,22)
$tabPage3.Name = "tabPage3"
$System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding
$System_Windows_Forms_Padding.All = 3
$System_Windows_Forms_Padding.Bottom = 3
$System_Windows_Forms_Padding.Left = 3
$System_Windows_Forms_Padding.Right = 3
$System_Windows_Forms_Padding.Top = 3
$tabPage3.Padding = $System_Windows_Forms_Padding
$tabPage3.Size = New-Object System.Drawing.Size(821,650)
$tabPage3.TabIndex = 2
$tabPage3.Text = "Processes"
$tabPage3.UseVisualStyleBackColor = $True
#
# dataGridProcesses
#
$dataGridProcesses.AllowUserToAddRows = $False
$dataGridProcesses.AllowUserToDeleteRows = $False
$dataGridProcesses.AllowUserToOrderColumns = $True
$System_Windows_Forms_DataGridViewCellStyle_56 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_56.BackColor = [System.Drawing.Color]::FromArgb(255,250,250,210)
$dataGridProcesses.AlternatingRowsDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_56
$System_Windows_Forms_DataGridViewCellStyle_57 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_57.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
$System_Windows_Forms_DataGridViewCellStyle_57.BackColor = [System.Drawing.Color]::FromArgb(255,240,230,140)
$System_Windows_Forms_DataGridViewCellStyle_57.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,0,3,1)
$System_Windows_Forms_DataGridViewCellStyle_57.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$System_Windows_Forms_DataGridViewCellStyle_57.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
$System_Windows_Forms_DataGridViewCellStyle_57.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_57.WrapMode = [System.Windows.Forms.DataGridViewTriState]::True
$dataGridProcesses.ColumnHeadersDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_57
$dataGridProcesses.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$System_Windows_Forms_DataGridViewCellStyle_58 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_58.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
$System_Windows_Forms_DataGridViewCellStyle_58.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_58.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,0,3,1)
$System_Windows_Forms_DataGridViewCellStyle_58.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$System_Windows_Forms_DataGridViewCellStyle_58.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
$System_Windows_Forms_DataGridViewCellStyle_58.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_58.WrapMode = [System.Windows.Forms.DataGridViewTriState]::False
$dataGridProcesses.DefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_58
$dataGridProcesses.EnableHeadersVisualStyles = $true
$dataGridProcesses.Location = New-Object System.Drawing.Point(8,31)
$dataGridProcesses.MultiSelect = $False
$dataGridProcesses.Name = "dataGridProcesses"
$dataGridProcesses.ReadOnly = $True
$System_Windows_Forms_DataGridViewCellStyle_59 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_59.Alignment = [System.Windows.Forms.DataGridViewContentAlignment]::MiddleLeft
$System_Windows_Forms_DataGridViewCellStyle_59.BackColor = [System.Drawing.Color]::FromArgb(255,240,240,240)
$System_Windows_Forms_DataGridViewCellStyle_59.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",8.25,0,3,1)
$System_Windows_Forms_DataGridViewCellStyle_59.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$System_Windows_Forms_DataGridViewCellStyle_59.SelectionBackColor = [System.Drawing.Color]::FromArgb(255,51,153,255)
$System_Windows_Forms_DataGridViewCellStyle_59.SelectionForeColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_59.WrapMode = [System.Windows.Forms.DataGridViewTriState]::True
$dataGridProcesses.RowHeadersDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_59
$dataGridProcesses.RowHeadersVisible = $False
$System_Windows_Forms_DataGridViewCellStyle_60 = New-Object System.Windows.Forms.DataGridViewCellStyle
$System_Windows_Forms_DataGridViewCellStyle_60.BackColor = [System.Drawing.Color]::FromArgb(255,255,255,255)
$System_Windows_Forms_DataGridViewCellStyle_60.ForeColor = [System.Drawing.Color]::FromArgb(255,0,0,0)
$dataGridProcesses.RowsDefaultCellStyle = $System_Windows_Forms_DataGridViewCellStyle_60
$dataGridProcesses.SelectionMode = [System.Windows.Forms.DataGridViewSelectionMode]::FullRowSelect
$dataGridProcesses.Size = New-Object System.Drawing.Size(807,613)
$dataGridProcesses.TabIndex = 3
#
# buttonStopProcess
#
$buttonStopProcess.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonStopProcess.Location = New-Object System.Drawing.Point(544,4)
$buttonStopProcess.Name = "buttonStopProcess"
$buttonStopProcess.Size = New-Object System.Drawing.Size(75,23)
$buttonStopProcess.TabIndex = 2
$buttonStopProcess.Text = "StopProcess"
$buttonStopProcess.UseVisualStyleBackColor = $True
$buttonStopProcess.add_Click($handler_buttonStopProcess_Click)
#
# buttonGetProcesses
#
$buttonGetProcesses.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonGetProcesses.Location = New-Object System.Drawing.Point(8,4)
$buttonGetProcesses.Name = "buttonGetProcesses"
$buttonGetProcesses.Size = New-Object System.Drawing.Size(75,23)
$buttonGetProcesses.TabIndex = 1
$buttonGetProcesses.Text = "GetProcesses"
$buttonGetProcesses.UseVisualStyleBackColor = $True
$buttonGetProcesses.add_Click($handler_buttonGetProcesses_Click)
#
# tabPage4
#
$tabPage4.Controls.Add($richTextBoxNetworkDetails)
$tabPage4.Controls.Add($buttonGetNICs)
$tabPage4.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$tabPage4.Location = New-Object System.Drawing.Point(4,22)
$tabPage4.Name = "tabPage4"
$System_Windows_Forms_Padding = New-Object System.Windows.Forms.Padding
$System_Windows_Forms_Padding.All = 3
$System_Windows_Forms_Padding.Bottom = 3
$System_Windows_Forms_Padding.Left = 3
$System_Windows_Forms_Padding.Right = 3
$System_Windows_Forms_Padding.Top = 3
$tabPage4.Padding = $System_Windows_Forms_Padding
$tabPage4.Size = New-Object System.Drawing.Size(821,650)
$tabPage4.TabIndex = 3
$tabPage4.Text = "Network"
$tabPage4.UseVisualStyleBackColor = $True
#
# richTextBoxNetworkDetails
#
$richTextBoxNetworkDetails.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$richTextBoxNetworkDetails.Font = New-Object System.Drawing.Font("Courier New",8.25,0,3,1)
$richTextBoxNetworkDetails.Location = New-Object System.Drawing.Point(8,37)
$richTextBoxNetworkDetails.Name = "richTextBoxNetworkDetails"
$richTextBoxNetworkDetails.Size = New-Object System.Drawing.Size(807,607)
$richTextBoxNetworkDetails.TabIndex = 1
$richTextBoxNetworkDetails.Text = ""
#
# buttonGetNICs
#
$buttonGetNICs.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
$buttonGetNICs.Location = New-Object System.Drawing.Point(8,7)
$buttonGetNICs.Name = "buttonGetNICs"
$buttonGetNICs.Size = New-Object System.Drawing.Size(75,23)
$buttonGetNICs.TabIndex = 0
$buttonGetNICs.Text = "GetNICs"
$buttonGetNICs.UseVisualStyleBackColor = $True
$buttonGetNICs.add_Click($handler_buttonGetNICs_Click)
#endregion Generated Form Code
#----------------------------------------------
#Save the initial state of the form
$InitialFormWindowState = $formulier.WindowState
#Init the OnLoad event to correct the initial state of the form
$formulier.add_Load($Form_StateCorrection_Load)
#Show the Form
return $formulier.ShowDialog()
} #End Function
#Call OnApplicationLoad to initialize
if(OnApplicationLoad -eq $true)
{
#Create the form
Call-GUI_serverinfo_pff | Out-Null
#Perform cleanup
OnApplicationExit
}