Intune Initial Scripts Backup
This commit is contained in:
693
dump/SCCM-Tool/NA-Tool-GUI-5x.ps1
Normal file
693
dump/SCCM-Tool/NA-Tool-GUI-5x.ps1
Normal file
@@ -0,0 +1,693 @@
|
||||
#------------------------------------------------------------------------
|
||||
# Source File Information (DO NOT MODIFY)
|
||||
# Source ID: 676f8db7-35c7-452d-b353-a4b40f26243a
|
||||
# Source File: Form-Template.psf
|
||||
#------------------------------------------------------------------------
|
||||
#region File Recovery Data (DO NOT MODIFY)
|
||||
<#RecoveryData:
|
||||
RAUAAB+LCAAAAAAABAC9VNtKwzAYvhd8h5Dr2oPd3AZtYXTuxtNwQ72TrP07o2lSknSzPr3p2g1x
|
||||
QkHGKJSk+Q7/KQ0eIRFrkNWEaILMQlHBQ3xpezg6P0MoeJB0RTlhU8rgnuQQTYXMLxaQF4xosAuV
|
||||
Bc4BpmEu3yHRSFcFhHheKQ25/Ux5KjbKrkWat4X+OrLQUxtKz3brx0JxyXQpIeRQakmYhWblktHk
|
||||
BqqF+AAeLgcD0k/6V97I74E7HGHETSghzoyeh1HyRlkqDQ7HgmspmGoSNIHOpChA6qoljEst5glh
|
||||
MKE58DoIA72ykOcHzg7aRb0TKWBTKq47OTGjwPWcfhnCwDU+/nDYSaqrjKNtap3YBXxqvG3bIfR6
|
||||
bbxb3K0gaav5Wq8DZ3vaNNNputlsxkpBbooPaqfTfqmiXCVCMro8QgMDZ6/626UZmVN4HH0sux3r
|
||||
m3gaI0k2lK/+4+X6WT8bZJ6X9l3ik26vl5ydJKdYSDi+0X7bjHzg/PxrRt9OzyrdRAUAAA==#>
|
||||
#endregion
|
||||
|
||||
<#
|
||||
.NOTES
|
||||
--------------------------------------------------------------------------------
|
||||
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.141
|
||||
Generated on: 8/29/2017 11:53 AM
|
||||
Generated by: Haidey2
|
||||
--------------------------------------------------------------------------------
|
||||
.DESCRIPTION
|
||||
GUI script generated by PowerShell Studio 2017
|
||||
#>
|
||||
|
||||
|
||||
#----------------------------------------------
|
||||
#region Application Functions
|
||||
#----------------------------------------------
|
||||
|
||||
#endregion Application Functions
|
||||
|
||||
#----------------------------------------------
|
||||
# Generated Form Function
|
||||
#----------------------------------------------
|
||||
function Show-Form-Template_psf {
|
||||
|
||||
#----------------------------------------------
|
||||
#region Import the Assemblies
|
||||
#----------------------------------------------
|
||||
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
|
||||
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
|
||||
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
|
||||
#endregion Import Assemblies
|
||||
|
||||
#----------------------------------------------
|
||||
#region Generated Form Objects
|
||||
#----------------------------------------------
|
||||
[System.Windows.Forms.Application]::EnableVisualStyles()
|
||||
$form1 = New-Object 'System.Windows.Forms.Form'
|
||||
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
|
||||
|
||||
|
||||
$Script:Output = New-Object System.Windows.Forms.TextBox
|
||||
$Script:Collection_DropDownBox = New-Object System.Windows.Forms.ComboBox
|
||||
$Script:Deployment_DropDownBox = New-Object System.Windows.Forms.ComboBox
|
||||
$Script:Combobox_Tools = New-Object System.Windows.Forms.ComboBox
|
||||
|
||||
$GroupBox = New-Object System.Windows.Forms.GroupBox
|
||||
$GroupBox_Info = New-Object System.Windows.Forms.GroupBox
|
||||
|
||||
$Script:RadioButton_Window = New-Object System.Windows.Forms.RadioButton
|
||||
$Script:RadioButton_GridView = New-Object System.Windows.Forms.RadioButton
|
||||
$Script:RadioButton_CSV = New-Object System.Windows.Forms.RadioButton
|
||||
$Button_Go = New-Object System.Windows.Forms.Button
|
||||
$Script:TextBox_CollectionName = New-Object “System.Windows.Forms.TextBox”
|
||||
|
||||
#$PanelEventLogs_Events = New-Object 'System.Windows.Forms.Panel'
|
||||
#$PanelEventLogs_Filter = New-Object 'System.Windows.Forms.Panel'
|
||||
|
||||
|
||||
#$Text_ELogs_ServerName = New-Object 'System.Windows.Forms.TextBox'
|
||||
#$Text_ELogs_EventID = New-Object 'System.Windows.Forms.TextBox'
|
||||
#$Text_Elogs_DaysBack = New-Object 'System.Windows.Forms.TextBox'
|
||||
|
||||
$label_CollectionName = New-Object 'System.Windows.Forms.Label'
|
||||
$label_DeploymentName = New-Object 'System.Windows.Forms.Label'
|
||||
$label_DeploymentTime = New-Object 'System.Windows.Forms.Label'
|
||||
$label_DeviceCount = New-Object 'System.Windows.Forms.Label'
|
||||
|
||||
|
||||
$Button_ELogs_Connect = New-Object 'System.Windows.Forms.Button'
|
||||
|
||||
|
||||
|
||||
|
||||
# $Location = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
|
||||
$Script:ALL_Patch_Servers = @()
|
||||
$Script:Responding = @()
|
||||
$Script:NotResponding = @()
|
||||
$Global:Collection_Name = ""
|
||||
$Global:Select_Tool
|
||||
$Global:Output_Type = ""
|
||||
$Global:Deployments = ""
|
||||
|
||||
#endregion Generated Form Objects
|
||||
|
||||
#----------------------------------------------
|
||||
# User Generated Script
|
||||
#----------------------------------------------
|
||||
|
||||
$form1_Load={
|
||||
#TODO: Initialize Form Controls here
|
||||
|
||||
}
|
||||
|
||||
$Script:Collection_DropDownBox_SelectedIndexChanged={
|
||||
|
||||
$Script:Output.Text = $Script:Collection_DropDownBox.Text
|
||||
}
|
||||
|
||||
$Script:Deployment_DropDownBox_SelectedIndexChanged={
|
||||
Deployed-to-Collections
|
||||
$Script:Output.Text = $Script:Deployment_DropDownBox.Text
|
||||
}
|
||||
|
||||
$Script:Combobox_Tools_SelectedIndexChanged= {
|
||||
$Script:Output.Text = $Script:Combobox_Tools.Text
|
||||
}
|
||||
|
||||
$Button_Go_Click = {
|
||||
temp
|
||||
#SCCM-Module
|
||||
# $Global:Collection_Name = $Script:TextBox_CollectionName.Text #$Script:TextBox_CollectionName.Text
|
||||
# $Global:Select_Tool = $Script:Combobox_Tools.Text
|
||||
|
||||
|
||||
#$Output.Text = "$Global:Collection_Name --- $Global:Select_Tool " | Out-String
|
||||
#$Output.Text = | Out-String
|
||||
}
|
||||
|
||||
|
||||
##################################################################################################################
|
||||
Function ConnectTo-SCCM {
|
||||
|
||||
If(!(Get-PSDrive).Name -ne "CCX") {
|
||||
#
|
||||
# Press 'F5' to run this script. Running this script will load the ConfigurationManager
|
||||
# module for Windows PowerShell and will connect to the site.
|
||||
#
|
||||
# This script was auto-generated at '2/18/2021 10:12:39 AM'.
|
||||
|
||||
# Uncomment the line below if running in an environment where script signing is
|
||||
# required.
|
||||
#Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
|
||||
|
||||
# Site configuration
|
||||
$SiteCode = "CCX" # Site code
|
||||
$ProviderMachineName = "PNCRASCCM001.ccx.carecentrix.com" # SMS Provider machine name
|
||||
|
||||
# Customizations
|
||||
$initParams = @{}
|
||||
#$initParams.Add("Verbose", $true) # Uncomment this line to enable verbose logging
|
||||
#$initParams.Add("ErrorAction", "Stop") # Uncomment this line to stop the script on any errors
|
||||
|
||||
# Do not change anything below this line
|
||||
|
||||
# Import the ConfigurationManager.psd1 module
|
||||
if((Get-Module ConfigurationManager) -eq $null) {
|
||||
Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" @initParams
|
||||
}
|
||||
|
||||
# Connect to the site's drive if it is not already present
|
||||
if((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null) {
|
||||
New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName @initParams
|
||||
}
|
||||
|
||||
# Set the current location to be the site code.
|
||||
Set-Location "$($SiteCode):\" @initParams
|
||||
|
||||
#$Script:Output.Text = "inside connectoSCCM function"
|
||||
}#endIf
|
||||
}#endFunction
|
||||
##################################################################################################################
|
||||
Function SCCM-Module {
|
||||
Write-Host "Inside SCCM function" -ForegroundColor Cyan
|
||||
If(!(Get-PSDrive).Name -eq "sccm-drive") {
|
||||
|
||||
Import-Module 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'
|
||||
New-PSDrive -Name SCCM-Drive -PSProvider "AdminUI.PS.Provider\CMSite" -Root "PNCRASCCM001.ccx.carecentrix.com" -Description "SCCM Site"
|
||||
}#endIf
|
||||
$Script:Output.Text | Get-PSDrive | ft -AutoSize | Out-String
|
||||
CD sccm-drive:
|
||||
}#endFunction
|
||||
##################################################################################################################
|
||||
Function Update-Dropdown1 {
|
||||
# $Collections += $Script:Collection_DropDownBox.text
|
||||
$Collections = @("Collection-Servers","Ping-Collection","Check_Uptime","Test-Service","Remotely Update Policy","Software Update Status","Test-Sccm")
|
||||
$Collections | % { $Script:Combobox_Tools.Items.Add($_) }
|
||||
}
|
||||
##################################################################################################################
|
||||
Function temp {
|
||||
$Script:Output.Clear()
|
||||
#$Script:Script:Output.text = $Script:Collection_DropDownBox.text | Out-String
|
||||
|
||||
$Global:Collection_Name = $Script:TextBox_CollectionName.Text #$Script:TextBox_CollectionName.Text
|
||||
$Global:Select_Tool = $Script:Combobox_Tools.Text
|
||||
|
||||
|
||||
If ($Script:RadioButton_Window.Checked -eq $true) { $Global:Output_Type = "Window" <#; $Script:Output.Text = "Window_Radio1 Checked: $($Script:RadioButton_Window.Checked)" | Out-String #> }
|
||||
ElseIf ($Script:RadioButton_GridView.Checked -eq $true) { $Global:Output_Type = "Gridview" <#; $Script:Output.Text = "Gridview_Radio2 Checked: $($Script:RadioButton_GridView.Checked)" | Out-String #> }
|
||||
ElseIf ($Script:RadioButton_CSV.Checked -eq $true) { $Global:Output_Type = "Export" <#; $Script:Output.Text = "CSV_Radio3 Checked: $($Script:RadioButton_CSV.Checked)" | Out-String #> }
|
||||
|
||||
|
||||
If($Global:Collection_Name -and $Global:Select_Tool) {
|
||||
# If($Script:Collection_DropDownBox.text = "Tool1"){gcc}
|
||||
Run-Tool
|
||||
#$Script:TextBox_CollectionName.clear()
|
||||
$Script:Collection_DropDownBox.text = "----Select Tool----"
|
||||
#Clear-Variables
|
||||
}#endIf
|
||||
Else { #$T = { Write-Host "You must enter Collection Name ............!!" -ForegroundColor Red }
|
||||
$Script:Output.SelectionColor = 'red'
|
||||
$Script:Output.Text = "You must select 'Tool' and enter Collection Name............!!"
|
||||
}
|
||||
|
||||
Run-Defaults
|
||||
}#endFunction
|
||||
|
||||
|
||||
|
||||
|
||||
##################################################################################################################
|
||||
Function Run-Tool {
|
||||
|
||||
Switch($Global:Select_Tool) {
|
||||
Collection-Servers { Collection-Servers; Write-Host "Tool Selected: $Global:Select_Tool" }
|
||||
Ping-Collection { Ping_Collection }
|
||||
Check_Uptime { Check_Uptime }
|
||||
Test-Service { Test-Service }
|
||||
Test-SCCM { SCCM-Module }
|
||||
#"Remotely Update Policy" { $Script:Output.Text = Invoke-Expression $Location\Tool-Remotely-Restart-SCCMSyncCycle.ps1 | ft -AutoSize | Out-String }
|
||||
"Remotely Update Policy" { $Script:Output.Text = Invoke-Expression $Location\Tool-Remotely-Restart-SCCMSyncCycle.ps1 | ft -AutoSize | Out-String }
|
||||
"Software Update Status" { $Script:Output.Text = & "$Location\Tool-Get-SCCMSoftwareUpdateStatus.ps1" -Dep_ID 16778048 | ft -AutoSize | Out-String}
|
||||
}#endSwitch
|
||||
#Clear-Variables
|
||||
}#endFunction
|
||||
##################################################################################################################
|
||||
Function Run-Defaults {
|
||||
#$Script:TextBox_CollectionName.Text = "Nabil - Test Collection"
|
||||
$Script:RadioButton_Window.Checked = $true
|
||||
|
||||
<#
|
||||
If(!$Location) {
|
||||
$Location = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
}
|
||||
#>
|
||||
}
|
||||
##################################################################################################################
|
||||
Function xClear-Variables {
|
||||
$Global:Collection_Name = ""
|
||||
$Global:Select_Tool = ""
|
||||
$Global:Output_Type = ""
|
||||
|
||||
$Script:ALL_Patch_Servers = @()
|
||||
}
|
||||
##################################################################################################################
|
||||
Function Display-Results {
|
||||
#Param($Global:Output_Type,$Final_Result)
|
||||
Write-Host "DisplayType: $($Global:Output_Type)"
|
||||
Switch ($Global:Output_Type){
|
||||
|
||||
Window { $Script:Output.Text = $Script:ALL_Patch_Servers | Out-String}
|
||||
Gridview { $Script:ALL_Patch_Servers | Out-GridView }
|
||||
Export { $Script:ALL_Patch_Servers | Export-Csv -Path $Location\Results.csv -NoTypeInformation; ii $Location\Results.csv }
|
||||
|
||||
}#endSwitch
|
||||
|
||||
}
|
||||
#############################################################################################################################################################
|
||||
Function Collection-Servers {
|
||||
#Param($Coll_Name)
|
||||
|
||||
Write-Host "Collection:$Global:Collection_Name"
|
||||
$Script:ALL_Patch_Servers = @()
|
||||
|
||||
ConnectTo-SCCM
|
||||
#SCCM-Module
|
||||
#CD sccm-drive:
|
||||
$Script:DeviceCollection_MemberCount = Get-CMDeviceCollection -Name $Global:Collection_Name | select Name,MemberCount
|
||||
$Script:DeviceCollection_ServerNames = Get-CMCollectionMember -CollectionName $Global:Collection_Name | select Name,IsClient #| Export-Csv "E:\SCCM-Files\SCCM-Scripts\Files\$Global:Collection_Name.csv" -NoTypeInformation
|
||||
#$ServerName = $DeviceCollection_ServerNames.Name
|
||||
#Set-Location c:
|
||||
|
||||
#$Script:Temp = Get-CMCollectionMember -CollectionName $Global:Collection_Name #| select Name,IsClient
|
||||
|
||||
$Script:DeviceCollection_ServerNames | % {
|
||||
$Obj = New-Object -TypeName PSObject
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name Server -Value $_.Name
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name ClientInstalled -Value $_.IsClient
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name CollectionName -Value $Global:Collection_Name
|
||||
#$Obj | Add-Member -MemberType NoteProperty -Name CollectionMemberCount -Value {(Get-CMCollectionMember -Name $Global:Collection_Name).MemberCount}
|
||||
|
||||
$Obj
|
||||
$Script:ALL_Patch_Servers += $Obj
|
||||
|
||||
}#end%
|
||||
|
||||
# $Script:Output.Text = $Script:ALL_Patch_Servers | Out-String
|
||||
Display-Results #-Final_Result $Script:ALL_Patch_Servers
|
||||
Write-Host "$Script:ALL_Patch_Servers"
|
||||
$Script:ALL_Patch_Servers | Export-Csv $Location\Current-Collection-Servers.csv -NoTypeInformation
|
||||
|
||||
}#endFunction
|
||||
#############################################################################################################################################################
|
||||
Function Ping_Collection {
|
||||
|
||||
$Ping_Result = @()
|
||||
$NotResponding = @()
|
||||
$Responding = @()
|
||||
|
||||
ConnectTo-SCCM
|
||||
#SCCM-Module
|
||||
#CD sccm-drive:
|
||||
$Script:DeviceCollection_ServerNames1 = Get-CMCollectionMember -CollectionName $Global:Collection_Name | select Name
|
||||
#Set-Location c:
|
||||
|
||||
Write-Host "Total Server Count: $($Script:ALL_Patch_Servers.count)" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
############
|
||||
# $Script:Output.Text = "CollectionName: $($Global:Collection_Name) ------ hello "
|
||||
############
|
||||
$Script:DeviceCollection_ServerNames1.Name | % {
|
||||
$Server = $_
|
||||
$Obj = New-Object -TypeName PSObject
|
||||
|
||||
If (Test-Connection $Server -Count 1 -ErrorAction SilentlyContinue ) {
|
||||
#Write-Host "Responding:---- $_ " -ForegroundColor Green
|
||||
#$Script:Output.AppendText("Responding: $_")
|
||||
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name Server -Value $Server
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name Responding -Value "Yes"
|
||||
$Ping_Result += $Obj
|
||||
$Responding += $Server
|
||||
}#endIf
|
||||
|
||||
Else {
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name Server -Value $Server
|
||||
$Obj | Add-Member -MemberType NoteProperty -Name Responding -Value "No!"
|
||||
$Ping_Result += $Obj
|
||||
$NotResponding += $Server
|
||||
}
|
||||
}#end%
|
||||
$Script:Output.Text = $Ping_Result | ft -AutoSize | Out-String
|
||||
|
||||
write-host "-------------------------------------------------------"
|
||||
Write-host "$($Responding.count) / $($DeviceCollection_ServerNames1.count) -- Responding" -foregroundcolor Green
|
||||
Write-host "$($NotResponding.count) / $($DeviceCollection_ServerNames1.count) -- NOT Responding" -foregroundcolor Red
|
||||
|
||||
#Write-Host "Servers NOT Responding: $NotResponding " -ForegroundColor Red
|
||||
|
||||
}#endFunction
|
||||
#############################################################################################################################################################
|
||||
Function Check_Uptime {
|
||||
ConnectTo-SCCM
|
||||
$Script:DeviceCollection_ServerNames1 = Get-CMCollectionMember -CollectionName $Global:Collection_Name | select Name
|
||||
$Script:Output.Text = $Script:DeviceCollection_ServerNames1.name | % { gwmi win32_operatingsystem -ComputerName $_ -ErrorAction SilentlyContinue | select @{n="Server";e={$_.PSComputername}},@{n="LastReboot";e={$_.Converttodatetime($_.LastBootUpTime)}}} | sort LastBootup -descending | Out-String
|
||||
|
||||
}
|
||||
|
||||
#############################################################################################################################################################
|
||||
Function Deployment-List {
|
||||
Param($Deployment_History)
|
||||
# SCCM-Module
|
||||
$Global:Deployments = Get-CMDeployment | ? { $_.deploymenttime -gt ((Get-Date).AddDays(-"$Deployment_History")) }
|
||||
|
||||
#$T | select ApplicationName,CollectionName,DeploymentTime,AssignmentID,SoftwareName | % { $Deployment_DropDownBox.Items.Add($_) }
|
||||
$i = 0
|
||||
$Q = "" #@()
|
||||
|
||||
$Global:Deployments.ApplicationName | % { $Script:Deployment_DropDownBox.Items.Add($_)}
|
||||
<#
|
||||
foreach ($D in $Deployments) {
|
||||
$Q = $D.ApplicationName + "-------------------------------------------------------" + $D.CollectionName
|
||||
|
||||
$Deployment_DropDownBox.Items.Add($Q)
|
||||
$i++
|
||||
}
|
||||
#>
|
||||
|
||||
#$T.ApplicationName | % { $Deployment_DropDownBox.Items.Add($_) }
|
||||
|
||||
}#endFunction
|
||||
#############################################################################################################################################################
|
||||
Function Deployed-to-Collections {
|
||||
$T = $Global:Deployments | ? { $_.ApplicationName -eq "$($Script:Deployment_DropDownBox.text)" } | Select -ExpandProperty CollectionName
|
||||
$Script:Collection_DropDownBox.Items.Clear()
|
||||
$T | % { $Script:Collection_DropDownBox.Items.Add("$_")}
|
||||
}
|
||||
|
||||
#############################################################################################################################################################
|
||||
Function Test-Service {
|
||||
$T = Get-Service
|
||||
$Script:Output.Text = $T | ft -AutoSize | Out-String
|
||||
}
|
||||
##################################################################################################################
|
||||
|
||||
##################################################################################################################
|
||||
# --End User Generated Script--
|
||||
#----------------------------------------------
|
||||
#region Generated Events
|
||||
#----------------------------------------------
|
||||
|
||||
$Form_StateCorrection_Load=
|
||||
{
|
||||
#Correct the initial state of the form to prevent the .Net maximized form issue
|
||||
$form1.WindowState = $InitialFormWindowState
|
||||
}
|
||||
|
||||
$Form_Cleanup_FormClosed=
|
||||
{
|
||||
#Remove all event handlers from the controls
|
||||
try
|
||||
{
|
||||
$form1.remove_Load($form1_Load)
|
||||
$form1.remove_Load($Form_StateCorrection_Load)
|
||||
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
|
||||
|
||||
#$PanelEventLogs_Events.remove_Paint($PanelEventLogs_Events_Paint)
|
||||
#$PanelEventLogs_Filter.remove_Paint($PanelEventLogs_Filter_Paint)
|
||||
|
||||
$Text_Elogs_DaysBack.remove_TextChanged($Text_Elogs_DaysBack_TextChanged)
|
||||
$Text_ELogs_ServerName.remove_TextChanged($Text_ELogs_ServerName_TextChanged)
|
||||
$Text_ELogs_EventID.remove_TextChanged($Text_ELogs_EventID_TextChanged)
|
||||
|
||||
$Script:Output.remove_TextChanged($Output_TextChanged)
|
||||
$Script:Collection_DropDownBox.remove_SelectedIndexChanged($Script:Collection_DropDownBox_SelectedIndexChanged)
|
||||
$Script:Deployment_DropDownBox.remove_SelectedIndexChanged($Script:Deployment_DropDownBox_SelectedIndexChanged)
|
||||
$Script:Combobox_Tools.remove_SelectedIndexChanged($Script:Combobox_Tools_SelectedIndexChanged)
|
||||
$Script:RadioButton_Window.remove_SelectedIndexChanged($Script:RadioButton_Window_SelectedIndexChanged)
|
||||
$Script:RadioButton_GridView.remove_SelectedIndexChanged($Script:RadioButton_GridView_SelectedIndexChanged)
|
||||
$Script:RadioButton_CSV.remove_SelectedIndexChanged($Script:RadioButton_CSV_SelectedIndexChanged)
|
||||
$Button_Go.remove_Click($Button_Go_Click)
|
||||
|
||||
}
|
||||
catch { Out-Null <# Prevent PSScriptAnalyzer warning #> }
|
||||
}
|
||||
|
||||
|
||||
#$PanelEventLogs_Events_Paint=[System.Windows.Forms.PaintEventHandler]{ <#Event Argument: $_ = [System.Windows.Forms.PaintEventArgs]#> }
|
||||
#$PanelEventLogs_Filter_Paint=[System.Windows.Forms.PaintEventHandler]{ }
|
||||
|
||||
$Text_ELogs_ServerName_TextChanged={}
|
||||
$Text_Elogs_DaysBack_TextChanged={}
|
||||
|
||||
#endregion Generated Events
|
||||
|
||||
#----------------------------------------------
|
||||
#region Generated Form Code
|
||||
#----------------------------------------------
|
||||
#
|
||||
# form1
|
||||
#
|
||||
#$form1.Controls.Add($PanelEventLogs_Events)
|
||||
#$form1.Controls.Add($PanelEventLogs_Filter)
|
||||
|
||||
$form1.Controls.Add($Output)
|
||||
$form1.Controls.Add($Script:Collection_DropDownBox)
|
||||
$form1.Controls.Add($Script:Deployment_DropDownBox)
|
||||
$form1.Controls.Add($Script:Combobox_Tools)
|
||||
$form1.Controls.Add($GroupBox)
|
||||
$form1.Controls.Add($GroupBox_Info)
|
||||
$form1.controls.Add($Script:RadioButton_Window)
|
||||
$form1.controls.Add($Script:RadioButton_GridView)
|
||||
$form1.Controls.Add($Script:RadioButton_CSV)
|
||||
$form1.Controls.Add($Button_Go)
|
||||
$form1.Controls.Add($Script:TextBox_CollectionName)
|
||||
$form1.Controls.Add($label_CollectionName)
|
||||
$form1.Controls.Add($label_DeploymentName)
|
||||
$form1.Controls.Add($label_DeploymentTime)
|
||||
$form1.Controls.Add($label_DeviceCount)
|
||||
|
||||
|
||||
$form1.AutoScaleDimensions = '6, 13'
|
||||
$form1.AutoScaleMode = 'Font'
|
||||
$form1.ClientSize = '1000, 800'
|
||||
$form1.Name = 'form1'
|
||||
$form1.Text = 'Form'
|
||||
$form1.add_Load($form1_Load)
|
||||
#endregion Generated Form Code
|
||||
|
||||
#----------------------------------------------
|
||||
<#
|
||||
$PanelEventLogs_Events.Controls.Add($Text_ELogs_ServerName)
|
||||
$PanelEventLogs_Events.Controls.Add($Button_ELogs_Connect)
|
||||
$PanelEventLogs_Events.Controls.Add($Button_ELogs_View)
|
||||
$PanelEventLogs_Events.Controls.Add($Combobox_EventLogs_LogsList)
|
||||
$PanelEventLogs_Events.Controls.Add($VCenterUserPassword)
|
||||
$PanelEventLogs_Events.Controls.Add($CheckBoxUseWindowsLogin)
|
||||
$PanelEventLogs_Events.Controls.Add($labelVCenterUserName)
|
||||
$PanelEventLogs_Events.Controls.Add($labelVCenterPassword)
|
||||
$PanelEventLogs_Events.Controls.Add($Script:Collection_DropDownBox)
|
||||
$PanelEventLogs_Events.BackColor = '153,153,153'
|
||||
$PanelEventLogs_Events.Location = '6, 6'
|
||||
$PanelEventLogs_Events.Name = 'panelEventLogs_Events'
|
||||
$PanelEventLogs_Events.Size = '598, 56'
|
||||
$PanelEventLogs_Events.TabIndex = 0
|
||||
$PanelEventLogs_Events.add_Paint($PanelEventLogs_Events_Paint)
|
||||
|
||||
$PanelEventLogs_Filter.Controls.Add($Combobox_ELogsFilter_Level)
|
||||
$PanelEventLogs_Filter.Controls.Add($Text_ELogs_EventID)
|
||||
$PanelEventLogs_Filter.Controls.Add($Text_Elogs_DaysBack)
|
||||
$PanelEventLogs_Filter.Controls.Add($label_ELogs_Level)
|
||||
$PanelEventLogs_Filter.Controls.Add($label_ELogs_EventID)
|
||||
$PanelEventLogs_Filter.Controls.Add($label_ELogs_DaysBack)
|
||||
$PanelEventLogs_Filter.BackColor = '255,255,212'
|
||||
$PanelEventLogs_Filter.Location = '6, 62'
|
||||
$PanelEventLogs_Filter.Name = 'PanelEventLogs_Filter'
|
||||
$PanelEventLogs_Filter.Size = '598, 56'
|
||||
$PanelEventLogs_Filter.BorderStyle = 'FixedSingle'
|
||||
$PanelEventLogs_Filter.TabIndex = 0
|
||||
$PanelEventLogs_Filter.add_Paint($PanelEventLogs_Filter_Paint)
|
||||
#>
|
||||
#
|
||||
# $Text_ELogs_ServerName
|
||||
<#
|
||||
$Text_ELogs_ServerName.Location = '8, 26'
|
||||
$Text_ELogs_ServerName.Name = '$Text_ELogs_ServerName'
|
||||
$Text_ELogs_ServerName.Size = '100, 20'
|
||||
$Text_ELogs_ServerName.text = "l2012"
|
||||
$Text_ELogs_ServerName.TabIndex = 6
|
||||
$Text_ELogs_ServerName.add_TextChanged($Text_ELogs_ServerName_TextChanged)
|
||||
#
|
||||
#
|
||||
# Text_ELogs_EventID
|
||||
#
|
||||
$Text_ELogs_EventID.Location = '115, 26'
|
||||
$Text_ELogs_EventID.Name = 'Text_ELogs_EventID'
|
||||
$Text_ELogs_EventID.Size = '40, 20'
|
||||
$Text_ELogs_EventID.TabIndex = 7
|
||||
$Text_ELogs_EventID.add_TextChanged($Text_ELogs_EventID_TextChanged)
|
||||
#
|
||||
# Text_Elogs_DaysBack
|
||||
#
|
||||
$Text_Elogs_DaysBack.Location = '175, 26'
|
||||
$Text_Elogs_DaysBack.Name = 'Text_Elogs_DaysBack'
|
||||
$Text_Elogs_DaysBack.Size = '40, 20'
|
||||
$Text_Elogs_DaysBack.TabIndex = 7
|
||||
$Text_Elogs_DaysBack.add_TextChanged($Text_Elogs_DaysBack_TextChanged)
|
||||
#>
|
||||
# Output
|
||||
#
|
||||
$Output.Location = '10, 250'
|
||||
$Output.Multiline = $True
|
||||
$Output.Name = 'Output'
|
||||
$Output.ScrollBars = 'both'
|
||||
$Output.Size = '965, 500'
|
||||
$Output.Font = 'Consolas, 8.25pt'
|
||||
$Output.WordWrap = $False
|
||||
$Output.TabIndex = 5
|
||||
$Output.add_TextChanged($Output_TextChanged)
|
||||
#
|
||||
# ComboboxServiceStartMode
|
||||
#
|
||||
$Script:Collection_DropDownBox.FormattingEnabled = $True
|
||||
$Script:Collection_DropDownBox.Location = '20, 80'
|
||||
$Script:Collection_DropDownBox.Name = 'Script:Collection_DropDownBox'
|
||||
$Script:Collection_DropDownBox.Size = '180, 20'
|
||||
$Script:Collection_DropDownBox.TabIndex = 2
|
||||
$Script:Collection_DropDownBox.Text = '--Deployed to Collections--'
|
||||
$Script:Collection_DropDownBox.add_SelectedIndexChanged($Script:Collection_DropDownBox_SelectedIndexChanged)
|
||||
#
|
||||
$Script:Deployment_DropDownBox.Location = '20,30'
|
||||
#$Script:Deployment_DropDownBox.Size = New-Object System.Drawing.Size(580,50)
|
||||
$Script:Deployment_DropDownBox.Size = '580,50'
|
||||
#$Script:Deployment_DropDownBox.DropDownHeight = 200
|
||||
$Script:Deployment_DropDownBox.text = "----Select Deployment----"
|
||||
#$Script:Deployment_DropDownBox.Visible = $false
|
||||
$Script:Deployment_DropDownBox.add_SelectedIndexChanged($Script:Deployment_DropDownBox_SelectedIndexChanged)
|
||||
#
|
||||
#$Script:Combobox_Tools.Size = New-Object System.Drawing.Size(180,20)
|
||||
#$Script:Combobox_Tools.DropDownHeight = 200
|
||||
$Script:Combobox_Tools.text = "----Select Tool----!"
|
||||
$Script:Combobox_Tools.Location = '20,170'
|
||||
$Script:Combobox_Tools.Size = '180,10'
|
||||
$Script:Combobox_Tools.add_SelectedIndexChanged($Script:Combobox_Tools_SelectedIndexChanged)
|
||||
#
|
||||
$groupBox.Location = '270,70'
|
||||
$groupBox.size = New-Object System.Drawing.Size(150,90)
|
||||
$groupBox.text = "Select Output:"
|
||||
|
||||
|
||||
$GroupBox.Controls.Add($Script:RadioButton_Window)
|
||||
$GroupBox.Controls.Add($Script:RadioButton_GridView)
|
||||
$GroupBox.Controls.Add($Script:RadioButton_CSV)
|
||||
#
|
||||
$GroupBox_Info.Location = '670,25'
|
||||
$GroupBox_Info.Size = '300,200'
|
||||
$GroupBox_Info.Text = "Deployment Info"
|
||||
############
|
||||
$GroupBox_Info.Controls.Add($label_CollectionName)
|
||||
$GroupBox_Info.Controls.Add($label_DeploymentName)
|
||||
$GroupBox_Info.Controls.Add($label_DeploymentTime)
|
||||
$GroupBox_Info.Controls.Add($label_DeviceCount)
|
||||
############
|
||||
$label_CollectionName.AutoSize = $True
|
||||
$label_CollectionName.Font = 'Microsoft Sans Serif, 8.50pt, style=Bold'
|
||||
$label_CollectionName.ForeColor = 'DarkGreen'
|
||||
#$label_CollectionName.TextAlign = 'MiddleRight'
|
||||
$label_CollectionName.Location = '20,25'
|
||||
$label_CollectionName.Name = 'Collection_Name'
|
||||
$label_CollectionName.Size = '41, 13'
|
||||
#$label_CollectionName.TabIndex = 6
|
||||
$label_CollectionName.Text = 'Collection Name:'
|
||||
#$label_CollectionName.add_Click($label_CollectionName_Click)
|
||||
############
|
||||
$label_DeploymentName.AutoSize = $True
|
||||
$label_DeploymentName.Font = 'Microsoft Sans Serif, 8.50pt, style=Bold'
|
||||
$label_DeploymentName.ForeColor = 'DarkGreen'
|
||||
#$label_DeploymentName.TextAlign = 'MiddleRight'
|
||||
$label_DeploymentName.Location = '20,45'
|
||||
$label_DeploymentName.Name = 'Deployment_Name'
|
||||
$label_DeploymentName.Size = '41, 13'
|
||||
#$label_DeploymentName.TabIndex = 6
|
||||
$label_DeploymentName.Text = 'Deployment Name:'
|
||||
#$label_DeploymentName.add_Click($label_DeploymentName_Click)
|
||||
############
|
||||
$label_DeploymentTime.AutoSize = $True
|
||||
$label_DeploymentTime.Font = 'Microsoft Sans Serif, 8.50pt, style=Bold'
|
||||
$label_DeploymentTime.ForeColor = 'DarkGreen'
|
||||
#$label_DeploymentTime.TextAlign = 'MiddleRight'
|
||||
$label_DeploymentTime.Location = '20,65'
|
||||
$label_DeploymentTime.Name = 'Deployment_Time'
|
||||
$label_DeploymentTime.Size = '41, 13'
|
||||
#$label_DeploymentTime.TabIndex = 6
|
||||
$label_DeploymentTime.Text = 'Collection Name:'
|
||||
#$label_DeploymentTime.add_Click($label_CollectionName_Click)
|
||||
############
|
||||
$label_DeviceCount.AutoSize = $True
|
||||
$label_DeviceCount.Font = 'Microsoft Sans Serif, 8.50pt, style=Bold'
|
||||
$label_DeviceCount.ForeColor = 'DarkGreen'
|
||||
#$label_DeviceCount.TextAlign = 'MiddleRight'
|
||||
$label_DeviceCount.Location = '20,85'
|
||||
$label_DeviceCount.Name = 'Device_Count'
|
||||
$label_DeviceCount.Size = '41, 13'
|
||||
#$label_DeviceCount.TabIndex = 6
|
||||
$label_DeviceCount.Text = 'Device Count:'
|
||||
#$label_DeviceCount.add_Click($label_DeviceCount_Click)
|
||||
############
|
||||
$Script:RadioButton_Window.Location = new-object System.Drawing.Point(15,15)
|
||||
$Script:RadioButton_Window.size = New-Object System.Drawing.Size(130,20)
|
||||
$Script:RadioButton_Window.Checked = $true
|
||||
$Script:RadioButton_Window.Text = "Window"
|
||||
#$Script:RadioButton_Window.
|
||||
#
|
||||
$Script:RadioButton_GridView.Location = new-object System.Drawing.Point(15,35)
|
||||
$Script:RadioButton_GridView.size = New-Object System.Drawing.Size(80,20)
|
||||
$Script:RadioButton_GridView.Checked = $False
|
||||
$Script:RadioButton_GridView.Text = "GridView"
|
||||
#
|
||||
$Script:RadioButton_CSV.Location = new-object System.Drawing.Point(15,55)
|
||||
$Script:RadioButton_CSV.size = New-Object System.Drawing.Size(80,20)
|
||||
$Script:RadioButton_CSV.Checked = $False
|
||||
$Script:RadioButton_CSV.Text = "CSV"
|
||||
#
|
||||
$Button_Go.Location = New-Object System.Drawing.Size(450,75)
|
||||
$Button_Go.Size = New-Object System.Drawing.Size(110,80)
|
||||
$Button_Go.Text = "Go"
|
||||
#$Button_Go.Add_Click({temp})
|
||||
$Button_Go.Add_Click($Button_Go_Click)
|
||||
#
|
||||
$Script:TextBox_CollectionName.Left = 20;
|
||||
$Script:TextBox_CollectionName.Top = 130;
|
||||
$Script:TextBox_CollectionName.width = 200;
|
||||
$Script:TextBox_CollectionName.Text = "Nabil - Test Collection"
|
||||
#
|
||||
############################################################################
|
||||
Update-Dropdown1
|
||||
ConnectTo-SCCM
|
||||
Deployment-List -Deployment_History 10
|
||||
$Script:Output.Text = "helloooooooo"
|
||||
#cd c:
|
||||
|
||||
|
||||
############################################################################
|
||||
|
||||
#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)
|
||||
#Clean up the control events
|
||||
$form1.add_FormClosed($Form_Cleanup_FormClosed)
|
||||
#Show the Form
|
||||
return $form1.ShowDialog()
|
||||
|
||||
} #End Function
|
||||
|
||||
#Call the form
|
||||
Show-Form-Template_psf | Out-Null
|
||||
Reference in New Issue
Block a user