add skripts
This commit is contained in:
14
ps/generic/csv_collum_join.ps
Normal file
14
ps/generic/csv_collum_join.ps
Normal file
@@ -0,0 +1,14 @@
|
||||
# CSV-Datei einlesen
|
||||
$data = Import-Csv -Path "C:\Users\joekun\Downloads\report.csv" -Delimiter ";"
|
||||
|
||||
# Spaltennamen abrufen
|
||||
$spaltennamen = $data[0].PSObject.Properties.Name
|
||||
|
||||
# Die zweite Spalte ermitteln
|
||||
$zweiteSpalte = $spaltennamen[1]
|
||||
|
||||
# Alle Werte aus der zweiten Spalte zusammenfassen
|
||||
$zusammenfassung = ($data | ForEach-Object { $_.$zweiteSpalte }) -join " + "
|
||||
|
||||
# Zusammenfassung ausgeben oder weiterverarbeiten
|
||||
$zusammenfassung | Out-File C:\Users\joekun\Downloads\zusammengefasst.txt
|
||||
30
ps/generic/scan_host_network.ps
Normal file
30
ps/generic/scan_host_network.ps
Normal file
@@ -0,0 +1,30 @@
|
||||
# Lokales Subnetz automatisch ermitteln
|
||||
$localIP = (Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias Ethernet* | Where-Object {$_.PrefixLength -le 32}).IPAddress
|
||||
if (-not $localIP) { $localIP = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object {$_.PrefixLength -le 32}).IPAddress }
|
||||
$subnet = ($localIP -split '\.')[0..2] -join '.'
|
||||
|
||||
Write-Host "Scanning subnet $subnet.0/24 ..." -ForegroundColor Cyan
|
||||
|
||||
$results = @()
|
||||
|
||||
1..254 | ForEach-Object {
|
||||
$ip = "$subnet.$_"
|
||||
if (Test-Connection -ComputerName $ip -Count 1 -Quiet) {
|
||||
# MAC-Adresse über ARP abfragen
|
||||
$mac = (arp -a $ip | Select-String $ip) -replace '\s{2,}', ' ' | ForEach-Object { ($_ -split ' ')[1] }
|
||||
# Hostname auflösen
|
||||
try {
|
||||
$hostname = ([System.Net.Dns]::GetHostEntry($ip)).HostName
|
||||
} catch {
|
||||
$hostname = "unbekannt"
|
||||
}
|
||||
$results += [PSCustomObject]@{
|
||||
IP = $ip
|
||||
MAC = $mac
|
||||
Hostname = $hostname
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Ergebnisse ausgeben
|
||||
$results | Format-Table -AutoSize
|
||||
60
ps/generic/uninstall_install_history.ps
Normal file
60
ps/generic/uninstall_install_history.ps
Normal file
@@ -0,0 +1,60 @@
|
||||
# --------------------------------------------
|
||||
# SOFTWARE INSTALL / UNINSTALL HISTORY
|
||||
# --------------------------------------------
|
||||
|
||||
Write-Host "`n=== SOFTWARE INSTALLATIONEN (Registry + Store) ===`n" -ForegroundColor Cyan
|
||||
|
||||
# --- Installationen über Registry ---
|
||||
$regPaths = @(
|
||||
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*",
|
||||
"HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*",
|
||||
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*"
|
||||
)
|
||||
|
||||
$installs = foreach ($path in $regPaths) {
|
||||
Get-ItemProperty $path -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.DisplayName -and $_.InstallDate } |
|
||||
Select-Object @{
|
||||
Name="Date"; Expression={
|
||||
try {
|
||||
[datetime]::ParseExact($_.InstallDate, "yyyyMMdd", $null)
|
||||
} catch {
|
||||
$null
|
||||
}
|
||||
}
|
||||
}, DisplayName, DisplayVersion, Publisher, UninstallString
|
||||
}
|
||||
|
||||
# --- Installationen über Windows Store (AppX) ---
|
||||
$appx = Get-AppxPackage |
|
||||
Select-Object @{
|
||||
Name = "Date";
|
||||
Expression = { $_.InstallDate }
|
||||
}, Name, Version, Publisher
|
||||
|
||||
$allInstalls = $installs + $appx | Sort-Object Date
|
||||
|
||||
$allInstalls | Format-Table Date, DisplayName, DisplayVersion, Publisher -AutoSize
|
||||
|
||||
|
||||
# --------------------------------------------
|
||||
Write-Host "`n=== SOFTWARE DEINSTALLATIONEN (Event Viewer) ===`n" -ForegroundColor Yellow
|
||||
|
||||
# MsiInstaller Events:
|
||||
# 1034 = Uninstall
|
||||
# 11724 = Removal success
|
||||
# 11707 = Install success (info only)
|
||||
|
||||
$events = Get-WinEvent -FilterHashtable @{
|
||||
LogName = "Application"
|
||||
ProviderName = "MsiInstaller"
|
||||
} -ErrorAction SilentlyContinue |
|
||||
Where-Object {
|
||||
$_.Id -eq 1034 -or $_.Id -eq 11724
|
||||
} |
|
||||
Select-Object TimeCreated, Id, Message
|
||||
|
||||
$events | Sort-Object TimeCreated |
|
||||
Format-Table TimeCreated, Id, Message -Wrap -AutoSize
|
||||
|
||||
Write-Host "`nFertig!`n"
|
||||
Reference in New Issue
Block a user