Donnerstag, 12. Februar 2026

Eine schnelle und kleine Lösung, um Logfiles mit PowerShell zu sammeln. Zur Erweiterung / Ideenfindung einfach mal hier eingetragen. KI Form
 
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

# --- GUI Setup ---
$form = New-Object System.Windows.Forms.Form
$form.Text = "Log Collector GUI"
$form.Size = New-Object System.Drawing.Size(800,600)
$form.StartPosition = "CenterScreen"

$label = New-Object System.Windows.Forms.Label
$label.Text = "Wähle Log-Samples zur Erfassung"
$label.AutoSize = $true
$label.Font = New-Object System.Drawing.Font("Arial",10,[System.Drawing.FontStyle]::Bold)
$label.Location = New-Object System.Drawing.Point(20,10)
$form.Controls.Add($label)

# --- Checkboxen ---
$checkboxes = @{}
$logs = @(
    "Application Event Log",
    "Battery Report",
    "Sleepstudy",
    "IpConfig All",
    "Installed Apps List",
    "Network Adapter Details",
    "Scheduled Tasks",
    "Service Tag + Model Info"
    "Windows Update-Protokoll - Get-Hotfix - "
)

$yPos = 40
foreach ($log in $logs) {
    $cb = New-Object System.Windows.Forms.CheckBox
    $cb.Text = $log
    $cb.AutoSize = $true
    $cb.Location = New-Object System.Drawing.Point(20,$yPos)
    $form.Controls.Add($cb)
    $checkboxes[$log] = $cb
    $yPos += 30
}

# --- Start Button ---

$btnStart = New-Object System.Windows.Forms.Button
$btnStart.Text = "Start Collection"
$btnStart.Size = New-Object System.Drawing.Size(150,30)
$btnStart.Location = New-Object System.Drawing.Point(20,450)
$form.Controls.Add($btnStart)

# --- Status Label ---
$status = New-Object System.Windows.Forms.Label
$status.Text = "Status: Wartet auf Auswahl..."
$status.AutoSize = $true
$status.Location = New-Object System.Drawing.Point(20,500)
$form.Controls.Add($status)

# --- Collection Logic ---
$btnStart.Add_Click({

    $tempDir = Join-Path $env:TEMP ("Logs_" + (Get-Date -Format "yyyyMMdd_HHmmss"))
    New-Item -Path $tempDir -ItemType Directory -Force | Out-Null

    $status.Text = "Status: Sammle Logs..."
    $form.Refresh()

    # Application Event Log
   # https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/wevtutil

    if ($checkboxes["Application Event Log"].Checked) {
        wevtutil epl Application /q:"*[System[(Level<=5)]]" (Join-Path $tempDir "application_eventlog.evtx")
    }

    # Battery Report
    #powercfg /batteryreport

    if ($checkboxes["Battery Report"].Checked) {
        powercfg /batteryreport /output (Join-Path $tempDir "Battery_Report.html") /duration 14
    }

    #Sleepstudy
    #https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/powercfg-command-line-options

    if ($checkboxes["Sleepstudy"].Checked) {
        powercfg /sleepstudy /output (Join-Path $tempDir "sleepstudy.html")
    }

    # IpConfig All
    if ($checkboxes["IpConfig All"].Checked) {
        ipconfig /all > (Join-Path $tempDir "ipconfig_all.txt")
    }

    # Installed Apps List
    if ($checkboxes["Installed Apps List"].Checked) {
        Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
            Select DisplayName,DisplayVersion,Publisher,InstallDate |
            Sort InstallDate |
            Format-Table –AutoSize |
            Out-File (Join-Path $tempDir "installed_apps.txt")
    }

    # Network Adapter Details
    if ($checkboxes["Network Adapter Details"].Checked) {
        Get-NetAdapter |
            Select Name,Status,MacAddress,LinkSpeed |
            Format-Table –AutoSize |
            Out-File (Join-Path $tempDir "netadapter_details.txt")
    }

    # Scheduled Tasks
    if ($checkboxes["Scheduled Tasks"].Checked) {
        Get-ScheduledTask | Where State -ne "Disabled" | Get-ScheduledTaskInfo |
            Format-Table –AutoSize |
            Out-File (Join-Path $tempDir "taskscheduler.txt")
    }

    # Service Tag + Model Info
    if ($checkboxes["Service Tag + Model Info"].Checked) {
        $tag = Get-CimInstance Win32_BIOS | Select-Object -ExpandProperty SerialNumber
        $model = Get-CimInstance Win32_ComputerSystem | Select-Object -ExpandProperty Model
        "$model`t$tag" | Out-File (Join-Path $tempDir "system_info.txt")
    }

   # Windows Update-Protokoll - Get-Hotfix - "
    if ($checkboxes["Windows Update-Protokoll - Get-Hotfix - "].Checked) {
        Get-Hotfix | Out-File (Join-Path $tempDir "Hotfix_info.txt")
    }

    $status.Text = "Status: Fertig! Logs im Ordner: $tempDir"
    explorer $tempDir
})

$form.ShowDialog()
Kategorie: programmierung

    anzeigen   


Mittwoch, 20. Dezember 2023

https://www.msxfaq.de/code/powershell/pserrhandling.htm

Try / Catch
 try {
   write-host "Hier wird was versucht, was schief gehen kann, z.B. Division durch 0"
   $a = 1/0
}
catch {
   write-host "Fehler abgefangen: `r`n $_.Exception.Message"

								}
finally {
    write-host "Finalize wird immer ausgeführt"
}
# Der Fehler wird zusaetzlich auch in $error hinterlegt
write-host $Error

Kategorie: programmierung

    anzeigen   



https://talkingpdf.org/forms-data-format-fdf/

http://www.lagotzki.de/pdftk/index.html#burst_cat

https://www-user.tu-chemnitz.de/~hot/pdf_formulare/

https://wiki.ubuntuusers.de/pdftk/

Kategorie: programmierung

    anzeigen   



https://www.itnator.net/akku-zustand-ermitteln-mit-powercfg-und-powershell/

Kategorie: programmierung

    anzeigen   



Funktion von itnator.net


 # Funktion deklarieren
function testfunktion ([int]$zahl){

    #Auszuführende Anweisung
    $ergebnis = $zahl * 2

    #Ergebnis ausgeben / zurück geben
    return $ergebnis
}

# Funktion aufrufen
testfunktion(80)

Kategorie: programmierung

    anzeigen   



PowerShell: Prüfen, ob Administrator-Rechte vorhanden

Run only as Admin
 if (! ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
    throw "Run with administrator rights"
} 

Kategorie: programmierung

    anzeigen   


Mittwoch, 4. Juni 2014

Das Zauberwort heisst Raycasting und wurde bei Spielen wie Daggerfall und Duke Nukem 3D eingesetzt.

Here's the trick: a raycasting engine doesn't draw the whole scene at once. Instead, it divides the scene into independent columns and renders them one-by-one. Each column represents a single ray cast out from the player at a particular angle. If the ray hits a wall, it measures the distance to that wall and draws a rectangle in its column. The height of the rectangle is determined by the distance the ray traveled - more distant walls are drawn shorter.

http://www.playfuljs.com/a-first-person-engine-in-265-lines/ - Via reddit .com
Kategorie: programmierung

    anzeigen   



Die PlayCanvas WebGL Game Engine ist nun Open Source.

Was ist PlayCanvas eigentlich?

Es ist eine JavaScript-Bibliothek, die speziell für den Aufbau von Videospielen entwickelt. Es implementiert alle wichtigen Komponenten wie:
  • Graphics: model loading, per-pixel lighting, shadow mapping, post effects
  • Physics: rigid body simulation, ray casting, joints, trigger volumes, vehicles
  • Animation: keyframing, skeletal blending, skinning
  • Audio engine: 2D and 3D audio sources
  • Input devices: mouse, keyboard, touch and gamepad support
  • Entity-component system: high level game object management
SWOOOP zeigt zum Beispiel, was man mit HTML5 und WebGL anfangen kann.

Weiter Links:
Samples, API Referenze, Developer Resources, Anleitungen
Kategorie: programmierung

    anzeigen   


Dienstag, 4. Februar 2014

Fade mit der ColorMatrix.

OrginalText codeproject.com
using System;
using System.Drawing;
using System.Drawing.Imaging;
 
namespace ImageUtils
{
    class ImageTransparency
    {
        public static Bitmap ChangeOpacity(Image img, float opacityvalue)
        {
            Bitmap bmp = new Bitmap(img.Width,img.Height); // Determining Width and Height of Source Image
            Graphics graphics = Graphics.FromImage(bmp);
            ColorMatrix colormatrix = new ColorMatrix();
            colormatrix.Matrix33 = opacityvalue;
            ImageAttributes imgAttribute = new ImageAttributes();
            imgAttribute.SetColorMatrix(colormatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            graphics.DrawImage(img, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, imgAttribute);
            graphics.Dispose();   // Releasing all resource used by graphics 
            return bmp;
        }
    }
}
pictureBox1.Image = ImageUtils.ImageTransparency.ChangeOpacity(Image.FromFile("filename"),opacityvalue);
Fade mit Alpha.

OrginalText stackoverflow.com
int alpha = 0;

private void timer1_Tick(object sender, EventArgs e)
{
    if (alpha++ < 255)
    {
    	Image image = pictureBox1.Image;
    	using (Graphics g = Graphics.FromImage(image))
    	{
    		Pen pen = new Pen(Color.FromArgb(alpha, 255, 255, 255), image.Width);
    		g.DrawLine(pen, -1, -1, image.Width, image.Height);
    		g.Save();
    	}
    	pictureBox1.Image = image;
    }
    else
    {
    	timer1.Stop();
    }
}
Fade mit Blur Effekt.

OrginalText Josh Jordan
        public static Bitmap Fade(Bitmap image1, Bitmap image2, int opacity)
        {
            Bitmap newBmp = new Bitmap(Math.Min(image1.Width,image2.Width), Math.Min(image1.Height,image2.Height));
            for (int i = 0; i < image1.Width & i < image2.Width; i++)
            {
                for (int j = 0; j < image1.Height & j < image2.Height; j++)
                {
                    Color image1Pixel = image1.GetPixel(i, j), image2Pixel = image2.GetPixel(i, j);
                    Color newColor = Color.FromArgb( (image1Pixel.R * opacity + image2Pixel.R * (100 - opacity) ) / 100, (image1Pixel.G * opacity + image2Pixel.G * (100 - opacity) ) / 100, (image1Pixel.B * opacity + image2Pixel.B * (100 - opacity) ) / 100);
                    newBmp.SetPixel(i, j, newColor);
                }
            }
            return newBmp;
int trans = 30;

pictureBox1.Image = Fade(new Bitmap(imgOld), new Bitmap(imgNew), trans);
Kategorie: programmierung

    anzeigen   


Dienstag, 10. Dezember 2013

 jQuery.fn.centerFix = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}
 
$('.div').centerFix();
Via der-webentwickler.net

Tags: jQuery, zentrieren
Kategorie: programmierung

    anzeigen