Skip to content

Instantly share code, notes, and snippets.

Mathias R. Jessen IISResetMe

  • Booking.com
  • Netherlands
Block or report user

Report or block IISResetMe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View EventForwardingPluginIssues_subscription.xml
<Subscription xmlns="http://schemas.microsoft.com/2006/03/windows/events/subscription">
<SubscriptionId>EventForwardingPluginIssues</SubscriptionId>
<SubscriptionType>SourceInitiated</SubscriptionType>
<Description>Operational events from the EventLog-ForwardingPlugin log on clients, used for troubleshooting</Description>
<Enabled>true</Enabled>
<Uri>http://schemas.microsoft.com/wbem/wsman/1/windows/EventLog</Uri>
<ConfigurationMode>MinLatency</ConfigurationMode>
<Query><![CDATA[
<QueryList>
<Query Id="0" Path="Microsoft-Windows-Forwarding/Operational">
View Microsoft.PowerShell_profile.ps1
$function:prompt = {
return "PS $($executionContext.SessionState.Path.CurrentLocation -replace [regex]::Escape($HOME.Trim('\')),'~')$('>' * ($nestedPromptLevel + 1)) "
}
@IISResetMe
IISResetMe / BigIntRange.class.ps1
Created Aug 13, 2019
Lazy range generator for `[bigint]`
View BigIntRange.class.ps1
class BigIntRange : System.Collections.IEnumerable
{
[bigint]$from
[bigint]$to
[bool]$Descending
BigIntRange([bigint]$from,[bigint]$to)
{
$this.from = $from
View syswow64detect.py
from ctypes import windll,c_ushort,byref
import platform
def is_syswow64_process():
if platform.architecture()[0] != "64bit":
# 32-bit OS, no syswow64 handling
return False
# Ok, 64-bit OS, let's see if the process is 32-bit
# Obtain process handle to self
View Write-SwiftEvent.ps1
function Write-SwiftEvent
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, Position=0)]
[Alias('ID','EID')]
[ValidateNotNullOrEmpty()]
[ValidateRange(0, 65535)]
[int]
${EventId},
View Compare-Array.ps1
function Compare-Array
{
param(
[array]$Ref,
[array]$Diff
)
$max = [math]::Max($Ref.Length,$Diff.Length)
for($i = 0; $i -lt $max; $i++){
View Compare-Array.ps1
function Compare-Array
{
param(
[array]$Ref,
[array]$Diff
)
$max = [math]::Max($Ref.Length,$Diff.Length)
for($i = 0; $i -lt $max; $i++){
View TrackRIDPools.ps1
if(-not (Get-CimInstance -ClassName Win32_ComputerSystem -Property DomainRole).DomainRole -band 4){
# Computer's not a DC
return
}
$logProperties = @{
LogName = 'System'
Source = 'RIDPoolTracker'
}
if (-not(Get-Eventlog -List | Where-Object {$_.LogDisplayName -eq $logProperties.LogName})) {
@IISResetMe
IISResetMe / Log-ChromeExtension.ps1
Created Jun 13, 2019
Discover chrome extensions and log information about them to event log
View Log-ChromeExtension.ps1
<#
.SYNOPSIS
Inventory Chrome Extension information and dump the info to the Windows Event Log
.DESCRIPTION
This is a simplified adaptation of zsattler's Set-ChromeExtensions.ps1 which writes extension info to a WMI namespace for SCCM to pick up
This version writes the information to a custom Windows Event Log instead, easily picked up for WEF or similar log forwarding tools.
Original script: https://github.com/zsattler/PowerShell/blob/master/Set-ChromeExtensions/Set-ChromeExtensions.ps1
Original blog post: https://zsattler.wordpress.com/2017/02/27/chrome-extension-inventory-for-sccm/
View ConditionalRegex.koan.ps1
using module PSKoans
[Koan(Position = 666)]
param()
Describe "Regex" {
It "breaks your brainz" {
$res = __ -match '^(?<pp>a )must-have tool(?(pp)|s)'
$res |Should -Be $true
}
You can’t perform that action at this time.