From 51152e6c992bf5074e805e2102f0eb57b3839ec3 Mon Sep 17 00:00:00 2001 From: Gabe Date: Sat, 9 Aug 2025 16:39:51 +0000 Subject: [PATCH] Upload files to "Fun\Random" --- "Fun\\Random/Output Boxes.ps1" | 105 +++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 "Fun\\Random/Output Boxes.ps1" diff --git "a/Fun\\Random/Output Boxes.ps1" "b/Fun\\Random/Output Boxes.ps1" new file mode 100644 index 0000000..cf74b74 --- /dev/null +++ "b/Fun\\Random/Output Boxes.ps1" @@ -0,0 +1,105 @@ +[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" + +} \ No newline at end of file