PowerShell – Adding Tabs to a Form

  Code.ps1   # MrNetTek # eddiejackson.net # 7/15/2022 # free for public use # free to claim as your own [void] [System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”) [void] [System.Reflection.Assembly]::LoadWithPartialName(“System.Drawing”) [void] [System.Reflection.Assembly]::LoadWithPartialName(“PresentationFramework”) [void] [Reflection.Assembly]::LoadWithPartialName(“PresentationCore”) $Form = New-Object System.Windows.Forms.Form $Form.Text = “Test Form” $Form.Size = New-Object System.Drawing.Size(630,840) $Form.StartPosition = “CenterScreen” $Form.ShowInTaskbar = $True $Form.KeyPreview = $True $Form.AutoSize = $True $Form.FormBorderStyle = Read More …

PowerShell – Detect if Administrator

Code.ps1   # MrNetTek # eddiejackson.net # 6/11/2022 # free for public use # free to claim as your own # DETECT IF FORM IS LAUNCH AS ADMIN $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) if (!$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { $message = [System.Windows.MessageBox]::Show(“Non-admin detected! `r`n`r`nPlease right-click on app and run as administrator.”,” ADMIN REQUIRED”) exit } Maximize Window Copy Read More …