Category Archives: Reference

Short references for personal… reference. Basically a howto for the tech-savvy.

How to use Invoke-WebRequest in PowerShell without having to first open Internet Explorer

So, you get this error message: Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer’s first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again. ..and sure, you could use -UseBasicParsing but, depending on your use case, you might then have to write […]

The trust relationship between this workstation and the primary domain failed

So, you resurrected a VM from the cold, damp crypts of the deepest backup dungeons, and now you can’t log in because the VM doesn’t trust the domain server anymore? That’s alright. The Windows Domain will rotate its keys from time to time, and an offline VM snapshot will not know about it. You don’t […]

Finding the first (default) IPv4 gateway in a Windows batch script

I recently had to whip out my Windows batch scripting skills to grab the default gateway for a routing script. Here’s what I ended up with: route print | findstr /R /C:”^[ ][ ]*0.0.0.0[ ]” | for /f “tokens=3” %%i in (‘more’) do (echo %%i & exit) >gw.tmpset /P gw=<gw.tmpdel gw.tmpecho “%gw%” This does, unfortunately, […]

Enable remote management of Windows Server Core and Hyper-V Core

This is a reference for the commands to enable the firewall rules necessary to remotely manage Windows Server Core and Hyper-V Core. I keep having to look these up… Enable-NetFireWallRule -DisplayName “Windows Management Instrumentation (DCOM-In)” Enable-NetFireWallRule -DisplayGroup “Remote Event Log Management” Enable-NetFireWallRule -DisplayGroup “Remote Service Management” Enable-NetFireWallRule -DisplayGroup “Remote Volume Management” Enable-NetFireWallRule -DisplayGroup “Remote Scheduled […]

My tweaks to get Kali Linux running well on the GPD Pocket

Mostly notes to myself, but hey, maybe it helps you too! Get Kali for the GPD Pocket I installed using re4son’s modified image from here. Removing the GRUB splash screen (it’s sideways anyway, which looks horrible, and I’m not multibooting) /etc/default/grub GRUB_TIMEOUT=0 GRUB_BACKGROUND=”” Speeding up WiFi so it doesn’t lag if you SSH into the […]

Finding the most expensive recent SQL queries on SQL Server

Mostly a note to self, original source here. SELECT TOP 10 SUBSTRING(qt.TEXT, (qs.statement_start_offset/2)+1, ((CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.TEXT) ELSE qs.statement_end_offset END – qs.statement_start_offset)/2)+1), qs.execution_count, qs.total_logical_reads, qs.last_logical_reads, qs.total_logical_writes, qs.last_logical_writes, qs.total_worker_time, qs.last_worker_time, qs.total_elapsed_time/1000000 total_elapsed_time_in_S, qs.last_elapsed_time/1000000 last_elapsed_time_in_S, qs.last_execution_time, qp.query_plan FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) qt CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp ORDER BY qs.total_logical_reads DESC — logical reads […]