Scripts/Handig.ps1


Start-Process cleanmgr -ArgumentList "/sagerun:1 /VeryLowDisk /AUTOCLEAN"

Get-ChildItem $env:TEMP | Remove-Item -Recurse -Force -ea 0


Get-UserProfiles | Where-Object { $_.LastUseTime -lt (Get-Date).AddDays(-180) } | Remove-CimInstance


New-InboxRule -FromAddressContainsWords support@henkie.nl -MoveToFolder someone@somewhere.com:\Inbox\Automail -Name "support@henkie.nl"



$FilePath = ".\wiki-logo-wit.png"

$Base64 = [Convert]::ToBase64String((Get-Content $FilePath -AsByteStream))
$Base64
$HTML = "<img src=`"data:image/png; base64, $($Base64)`" />"
$HTML
$HTML | clip

$OutFilePath = "C:\Temp\test.png"
$Image = [Drawing.Bitmap]::FromStream([IO.MemoryStream][Convert]::FromBase64String($Base))
$Image.Save($OutFilePath)



[System.Environment]::SetEnvironmentVariable("DockerFolder", "$($env:Onedrive)\Docker", "Machine")



# Remote wipe

$namespaceName = "root\cimv2\mdm\dmmap"
$className = "MDM_RemoteWipe"
$methodName = "doWipeMethod"

$session = New-CimSession

$params = New-Object Microsoft.Management.Infrastructure.CimMethodParametersCollection
$param = [Microsoft.Management.Infrastructure.CimMethodParameter]::Create("param", "", "String", "In")
$params.Add($param)

$instance = Get-CimInstance -Namespace $namespaceName -ClassName $className -Filter "ParentID='./Vendor/MSFT' and InstanceID='RemoteWipe'"

if ($WeetJeHetAbsoluutZeker) {
    $session.InvokeMethod($namespaceName, $instance, $methodName, $params)
}



# Detect onbekende devices / missende drivers
Get-PnpDevice | Where-Object Status -NotMatch "OK|Unknown" | Format-List



powercfg /batteryreport