Author Archives: bolt

Error 0x80041002 from PowerShell after upgrade to Windows 10

On a box I just upgraded, we run a script that’s supposed to add a new scheduled task. After the upgrade, attempting to create a new trigger would return this beauty: PS C:\Users\User> New-ScheduledTaskTrigger -AtStartup New-ScheduledTaskTrigger : Method “NewTriggerByStartup” not found + CategoryInfo : ObjectNotFound: (PS_ScheduledTask:Root/Microsoft/…S_ScheduledTask) [New-ScheduledTaskTrigger], CimException + FullyQualifiedErrorId : HRESULT 0x80041002,New-ScheduledTaskTrigger The solution […]

A few group policies I use on Windows 10

Disable the lock screen, always showing a login prompt: Group Policy Editor (gpedit.msc) => Computer Configuration => Administrative Templates => Control Panel => Personalization => Do not display the lock screen Disallow the use of OneDrive: Group Policy Editor (gpedit.msc) => Computer Configuration => Administrative Templates => Windows Components => OneDrive => Prevent the usage […]

Relay UDP broadcasts between subnets in pfSense

I recently had a need to do this at work, and was told by various forum posts and ##pfsense on freenode that it wasn’t a good idea and wasn’t possible. Well, we needed it anyway, so time to do some hacking πŸ˜€ Here’s the script I came up with. It employs tcpdump and tcpreplay to […]

Wiping an (Azure) SQL Server database, deleting all tables

Just for personal reference USE [mydb] GO WHILE(EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE=’FOREIGN KEY’)) BEGIN DECLARE @sql0 NVARCHAR(2000) SELECT TOP 1 @sql0=(‘ALTER TABLE [‘ + TABLE_SCHEMA + ‘].[‘ + TABLE_NAME + ‘] DROP CONSTRAINT [‘ + CONSTRAINT_NAME + ‘]’) FROM information_schema.table_constraints WHERE CONSTRAINT_TYPE = ‘FOREIGN KEY’ EXEC (@sql0) PRINT @sql0 END GO DECLARE @sql1 NVARCHAR(2000) […]

Mounting and using KVM raw image files on the host system

Boldly stolen from David Champion at the University of Chicago, and archived for personal reference. All credits to that page. kpartx will scan a block device β€” e.g., your /dev/loop0 β€” and create device-mapped specials under /dev/mapper for the partitions. Then you can address individual partitions. (N.B.: When done, before you can losetup -d the […]

Tool tip: “vbetool” runs real-mode video BIOS code to alter hardware state

This is so damn useful to turn on and off remote displays through SSH, for wall-mounted information screens and similar. Available in your friendly neighbourhood Linux distribution. VBETOOL(1) User Commands VBETOOL(1) NAME vbetool – run real-mode video BIOS code to alter hardware state SYNOPSIS vbetool [[vbestate save|restore]|[vbemode set|get]|[vgamode]|[dpms on|off|standby|suspend|reduced]|[post [romfile]]|[vgastate on|off]|[vbefp pan‐ elid|panelsize|getbrightness|setbrightness|invert]] DESCRIPTION vbetool […]

Solution: Using ProxyPass from http to https in apache2 causes AH02032 SNI error

I got this error message on the internal.server.host when forwarding an URL from an extrernal HTTP server to an internal HTTPS server: AH02032: Hostname internal.server.host provided via SNI and hostname external.server.host provided via HTTP are different The problem turned out to be that the internal server was trusting the external one’s X-Forwarded- headers, a feature […]