Intune Initial Scripts Backup
This commit is contained in:
43
dump/SCCM-Tool/Forms/Form-Examples/Form-Calendar.ps1
Normal file
43
dump/SCCM-Tool/Forms/Form-Examples/Form-Calendar.ps1
Normal file
@@ -0,0 +1,43 @@
|
||||
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
|
||||
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
|
||||
|
||||
$objForm = New-Object Windows.Forms.Form
|
||||
|
||||
$objForm.Text = "Select a Date"
|
||||
$objForm.Size = New-Object Drawing.Size @(490,250)
|
||||
$objForm.StartPosition = "CenterScreen"
|
||||
|
||||
$objForm.KeyPreview = $True
|
||||
|
||||
$objForm.Add_KeyDown({
|
||||
if ($_.KeyCode -eq "Enter")
|
||||
{
|
||||
$script:dtmDate=$objCalendar.SelectionStart
|
||||
$objForm.Close()
|
||||
}
|
||||
})
|
||||
|
||||
$objForm.Add_KeyDown({
|
||||
if ($_.KeyCode -eq "Escape")
|
||||
{
|
||||
$objForm.Close()
|
||||
}
|
||||
})
|
||||
|
||||
$objCalendar = New-Object System.Windows.Forms.MonthCalendar
|
||||
$objCalendar.Text = "Start"
|
||||
$objCalendar.ShowTodayCircle = $False
|
||||
$objCalendar.MaxSelectionCount = 1
|
||||
$objForm.Controls.Add($objCalendar)
|
||||
|
||||
$objForm.Topmost = $True
|
||||
|
||||
$objForm.Add_Shown({$objForm.Activate()})
|
||||
[void] $objForm.ShowDialog()
|
||||
|
||||
if ($dtmDate)
|
||||
{
|
||||
Write-Host "Date selected: $dtmDate"
|
||||
}
|
||||
|
||||
$objForm.Dispose()
|
||||
Reference in New Issue
Block a user