105 lines
2.3 KiB
PowerShell
105 lines
2.3 KiB
PowerShell
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
|
|
$result = [Microsoft.VisualBasic.Interaction]::MsgBox( `
|
|
"Run Delete System32?", 'YesNoCancel,Question', "Title")
|
|
|
|
switch ($result) {
|
|
'Yes' { "System32 has been deleted" }
|
|
'No' { "Sorry to hear that" }
|
|
'Cancel' { "Bye..." }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$a = new-object -comobject wscript.shell
|
|
$intAnswer = $a.popup("Do you want to delete these files?", `
|
|
0, "Delete Files", 4)
|
|
If ($intAnswer -eq 6) {
|
|
$a.popup("You answered yes. Good job.")
|
|
}
|
|
else {
|
|
$a.popup("You answered no, so get rekt. ")
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$msg = "Are you sure you want to kill process $process on computer $computername"
|
|
if ('Yes' -eq [System.Windows.Forms.MessageBox]::Show($msg, 'Warning', 'YesNo')) {
|
|
#Do Stuff
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Function Show-Msgbox {
|
|
Param(
|
|
[string]$message = $(Throw "You must specify a message"),
|
|
[string]$button = "okonly",
|
|
[string]$icon = "information",
|
|
[string]$title = "Message Box"
|
|
)
|
|
|
|
# Buttons: OkOnly, OkCancel, AbortRetryIgnore, YesNoCancel, YesNo, RetryCancel
|
|
# Icons: Critical, Question, Exclamation, Information
|
|
|
|
[reflection.assembly]::loadwithpartialname("microsoft.visualbasic") | Out-Null
|
|
|
|
[microsoft.visualbasic.interaction]::Msgbox($message, "$button,$icon", $title)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$rc = Show-Msgbox -message "Do you know what you're doing?" `
|
|
-icon "exclamation" -button "YesNoCancel" -title "Hey $env:username!!"
|
|
|
|
Switch ($rc) {
|
|
"Yes" { "I hope your resume is up to date." }
|
|
"No" { "Wise move." }
|
|
"cancel" { "When in doubt, punt." }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$missing = Get-NetAdapter | Select-Object -Property Name, InterfaceDescription, ifIndex
|
|
If ($missing -ne $null) {
|
|
Write-Host 'Here are the missing file(s):'
|
|
Echo $missing
|
|
|
|
# Send pop up alert
|
|
|
|
$missingWithNewlines = $([String]::Join(([Convert]::ToChar(10)).ToString(), $missing))
|
|
|
|
$ButtonType = [System.Windows.MessageBoxButton]::OK
|
|
|
|
$MessageboxTitle = “Please Process Files”
|
|
|
|
$Messageboxbody = “
|
|
The following are missing:
|
|
|
|
$missingWithNewlines”
|
|
|
|
$MessageIcon = [System.Windows.MessageBoxImage]::Warning
|
|
|
|
[System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $messageicon)
|
|
|
|
}
|
|
Else {
|
|
|
|
Write-Host "Nothing missing"
|
|
|
|
} |