Skip to content

Instantly share code, notes, and snippets.

@mawiseman
mawiseman / powershell-iis-and-default-modules.ps1
Created November 18, 2019 00:26
Installs the required modules to run IIS (and some other i use for development)
# Allow remote scripts
Set-ExecutionPolicy AllSigned
# Install SqlServer powershell modules
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name SqlServer
# Misc
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All -All
@mawiseman
mawiseman / powershell-generate-gallery.ps1
Created May 17, 2021 06:23
Create a quick html page displaying all images under the target irectory
@mawiseman
mawiseman / powershell-convert-svg-to-png
Created May 17, 2021 06:24
Users powershell to convert batch convert svg to png
cls
# CONSTANTS
$inkscapePath = "C:\Program Files\Inkscape\bin\inkscape.com"
# Get files to process
$sourcePath ="[[UPDATE WITH YOUR PAT]]"
$sourceFiles = Get-ChildItem -Path $sourcePath -File -Recurse -Filter *.svg
@mawiseman
mawiseman / UrlRewriteRules.config
Created February 28, 2023 22:11
Default web.config rewrite rules
<rule name="ForceWWW" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^yoursite.com" />
</conditions>
<action type="Redirect" url="https://www.yoursite.com/{R:0}" redirectType="Permanent" />
</rule>
<rule name="HTTPtoHTTPS" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
Import-Module WebAdministration
$results = Get-ChildItem "IIS:\SslBindings\" | ForEach-Object {
$store = $_.Store
$thumbprint = $_.Thumbprint
$cert = Get-ChildItem -Path Cert:\LocalMachine\$store | Where-Object { $_.Thumbprint -eq $thumbprint }
[PSCustomObject]@{
Host = $_.Host;
@mawiseman
mawiseman / generate-sitemap.ps1
Last active September 5, 2025 06:17
Generates a Sitemap of a site by scraping all the URLs on each page it finds. .\generate-sitemap.ps1 https://yousite.com
<#
.SYNOPSIS
Generates a sitemap.xml file for a website by crawling its pages concurrently.
.DESCRIPTION
This script starts crawling from a specified base URL, discovers
internal links, and maintains a list of found (unprocessed) and
processed URLs in text files. It filters URLs to ensure only
those belonging to the same domain are processed and allows
excluding URLs that contain specific path patterns.