Skip to content

Instantly share code, notes, and snippets.

View tinuwalther's full-sized avatar

Martin Walther tinuwalther

View GitHub Profile
@tinuwalther
tinuwalther / Demo.ps1
Last active May 6, 2023 10:26
PerformanceTests
<#
Tests for https://hcritter.devdojo.com/powershell-performance-test-file-reading
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)]
[Switch]$Measure
)
# Create a file with 50'000 lines

Authentifzierung in PowerShell

Downlevel Protokolle

  • WMI -> DCOM, RPC
    Get-WMIObject / Invoke-WMIMethod -ConputerName -Credential -Authoritoy (NTLM/Kerbersos, Realm) -Impersonation (Anonymus,Identify, Impersonate, Delegate)
  • WMIClass [WMISearcher]
  • PSDrive
    New-PSDrive -ComputerName -Credential
  • Acrive Directory, MSSQL
    Server, Credential
function Test-IsCurrentUserAdmin{
if($IsLinux){
if((id -u) -eq 0){
return $true
}else{
return $false
}
}
if($IsWindows){
$current = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
@tinuwalther
tinuwalther / New-vCenterDiagram.ps1
Last active November 17, 2022 17:33
New-vCenterDiagram
<#
.SYNOPSIS
New-vCenterDiagram.ps1
.DESCRIPTION
New-vCenterDiagram - Create a Mermaid Class Diagram.
.PARAMETER InputObject
Specify a valid InputObject.
# Disable Citrix Workspace AutoStart
if((id -u) -eq 0){
@(
'/Library/LaunchAgents'
'/Library/LaunchDaemons'
) | ForEach-Object {
$citrixitem = Get-ChildItem $_ | Where-Object Name -match citrix
Write-Host ($citrixitem | Select-Object Name, FullName | Out-String)
$citrixitem | ForEach-Object {
Rename-Item -Path $($_.FullName) -NewName $($_.FullName -replace '.plist', '.bak') -PassThru
@tinuwalther
tinuwalther / kms-settings.ps1
Last active August 29, 2022 07:31
KMS Setting
<#
.SYNOPSIS
Check KMS Settings
.DESCRIPTION
1. Get License Information from Windows Software Licensing Management Tool (slmgr.vbs)
2. Get KMS Information from DNS (nslookup -type=srv _vlmcs._tcp)
3. Get License Information from local Registry Software Protection Platform
4. Check connectivity to KMS Server and the port from the local Registry
5. Check connectivity to KMS Server and the port from the slmgr.vbs
@tinuwalther
tinuwalther / Write-MyLoginformation.ps1
Last active June 15, 2022 07:51
Write Loginformation to a logfile in markdown and the screen.
function Write-IXLoginformation {
<#
.SYNOPSIS
Write Loginformation
.DESCRIPTION
Write Loginformation to a logfile and, or screen. The default logfile-size is 4mb, to change this use the switch MaxLogFileSizeMB
.PARAMETER InputObject
Specify the input-object.