Skip to content

Instantly share code, notes, and snippets.

@lwalthert
lwalthert / .ps1
Created May 3, 2017 16:22
PRTG-Sensor-Powershell
enum PRTGUnit {
BytesBandwidth
BytesMemory
BytesDisk
Temperature
Percent
TimeResponse
TimeSeconds
Custom
Count
"gitProjectManager.baseProjectsFolders": [
"%HOME%\\git"
]
{
"key": "ctrl+enter",
"command": "editor.action.insertLineAfter",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+enter",
"command": "task.new",
"when": "editorTextFocus && editorLangId == 'todo'"
}
@lwalthert
lwalthert / shouldprocess.ps1
Created January 9, 2017 13:06
Should Process Example
function Stop-ProcessUsingWMI
{
[CmdletBinding(SupportsShouldProcess=$True)] param(
[parameter(mandatory=$true)] [regex] $pattern
)
foreach ($process in Get-WmiObject Win32_Process |
where { $_.Name -match $pattern })
{
if ($PSCmdlet.ShouldProcess(
"process $($process.Name) " +
@lwalthert
lwalthert / gist:b0b4884fe85ba88c09868fc923da3f7f
Last active July 4, 2016 11:42
Error Chocolatey install called with MDT
2016-07-01 14:22:03,533 [INFO ] - ============================================================
2016-07-01 14:22:03,548 [INFO ] - Chocolatey v0.9.10.2
2016-07-01 14:22:03,564 [DEBUG] - Chocolatey is running on Windows v 10.0.10586.0
2016-07-01 14:22:03,564 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2016-07-01 14:22:03,564 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2016-07-01 14:22:03,564 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install -y blitzrechnen34
2016-07-01 14:22:03,579 [DEBUG] - Received arguments: install -y blitzrechnen34
2016-07-01 14:22:03,611 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2016-07-01 14:22:03,626 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2016-07-01 14:22:03,626 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
$SFTCode = @"
[DllImport("kernel32")] public static extern uint EnumSystemFirmwareTables (uint FirmwareTableProviderSignature, IntPtr pFirmwareTableBuffer, uint BufferSize);
[DllImport("kernel32")] public static extern uint GetSystemFirmwareTable (uint FirmwareTableProviderSignature, uint FimrwareTableID, IntPtr pFirmwareTableBuffer, uint BufferSize);
"@
$SFT = Add-Type -MemberDefinition $SFTCode -Name "SFTKlasse" -Language CSharp -UsingNamespace "System.Reflection", "System.Diagnostics", "System.Collections.Generic" -PassThru
# 0×41435049=ACPI ? https://github.com/michaelforney/coreboot/blob/master/src/include/cbmem.h