Skip to content

Instantly share code, notes, and snippets.

View dstreefkerk's full-sized avatar

Daniel dstreefkerk

  • Sydney, Australia
View GitHub Profile
@dstreefkerk
dstreefkerk / templates.yaml
Last active July 14, 2022 08:56 — forked from EverythingSmartHome/templates.yaml
Home Assistant Mushroom card templates
#Showing the state of a temperature in a template card:
{{ states('sensor.your_temperature_sensor') }}
#Change the colour of the light depending on status:
{% if is_state('light.your_light', 'on') %}
orange
{% endif %}
#Welcome template:
#Updated to greet the user by first name only
@dstreefkerk
dstreefkerk / Parse-HibpJson.ps1
Last active March 10, 2022 16:59
Convert a Have I Been Pwned JSON file into CSV after cross-referencing with Active Directory
#requires -version 3
<#
.SYNOPSIS
Parse-HibpJson - Checks Active Directory for matching users, outputs info as objects
.DESCRIPTION
Cross-checks Active Directory for matching aliases from a HIBP breach JSON file, and then
lists the matching users and which breaches they were involved in.
Designed to be output to CSV for easy consumption in Excel with one breach per column
@dstreefkerk
dstreefkerk / Schedule-ChocoUpgradeAll.ps1
Last active March 8, 2022 20:52
PowerShell script to create a scheduled task that runs a choco upgrade all at machine startup
# See if choco.exe is available. If not, stop execution
$chocoCmd = Get-Command -Name 'choco' -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Select-Object -ExpandProperty Source
if ($chocoCmd -eq $null) { break }
# Settings for the scheduled task
$taskAction = New-ScheduledTaskAction –Execute $chocoCmd -Argument 'upgrade all -y'
$taskTrigger = New-ScheduledTaskTrigger -AtStartup
$taskUserPrincipal = New-ScheduledTaskPrincipal -UserId 'SYSTEM'
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8
@dstreefkerk
dstreefkerk / unattend.xml
Created June 7, 2017 00:41
Australia/Sydney regional settings Unattend.xml file for Windows 10 1703
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-AU</UILanguage>
</SetupUILanguage>
<InputLocale>0c09:00000409</InputLocale>
<UserLocale>en-AU</UserLocale>
<SystemLocale>en-AU</SystemLocale>
@dstreefkerk
dstreefkerk / ConditionalAccess-PolicyNames_and_IDs.txt
Created October 6, 2020 23:32
KQL Query to retrieve from Log Analytics a list of Conditional Access policy names and IDs
SigninLogs
| mv-expand ConditionalAccessPolicies
| project DisplayName = tostring(ConditionalAccessPolicies.displayName),ID = tostring(ConditionalAccessPolicies.id)
| distinct ID,DisplayName
| order by DisplayName asc
@dstreefkerk
dstreefkerk / Create-LocalAdminUser.ps1
Last active August 23, 2021 19:34
Creates a backup local admin user with a random password. Designed for use with Microsoft LAPS. Should be run as a computer logon script.
# The name of the account
$accountName = 'LocalAdmin'
$accountFullName = 'Local Administrator'
$accountComment = 'Backup Local Administrator Account'
# Any users listed here will be disabled by this script
$usersToDisable = 'Administrator','Guest'
# Set up some Event Log stuff
$sourceName = "$($MyInvocation.MyCommand.Name).ps1"
#Requires -Version 4.0 -RunAsAdministrator
<#
.SYNOPSIS
Manage-WiFiStatus.ps1 - Enable/Disable WiFi based on wired connectivity status
.DESCRIPTION
Disables the Wi-Fi adapter if the wired one is connected, and vice versa.
This is built for internal use on Windows 8.1, and depends on the new *-NetAdapter cmdlets in PS 4.0
@dstreefkerk
dstreefkerk / Remove-FilesiteViews.ps1
Created November 21, 2014 04:22
Remove VDM files for all users, for HP FileSite for Outlook
<#
.SYNOPSIS
Remove-FilesiteViews.ps1 - Remove VDM files for all users
.DESCRIPTION
This script is designed to be run under the SYSTEM account, as it needs
access to every user's profile. This will work fine as a scheduled task, or
under SCCM or similar.
As per the release notes for Filesite 9.0 Update 5, all VDM files need to be deleted
@dstreefkerk
dstreefkerk / Disable-OutlookAddins.ps1
Created July 7, 2015 02:51
Disable all Outlook add-ins except for a specified list
# List of add-in names that ARE permitted. Everything else will be disabled
$permittedAddIns = "Redemption.Addin","WorkSiteEmailManagement.Connect","imFileSite.Connect"
# Registry paths to search
$registryPaths = "Registry::HKEY_USERS\S-1-5-21-*\Software\Microsoft\Office\Outlook\Addins",
"Registry::HKEY_USERS\S-1-5-21-*\Software\Wow6432Node\Microsoft\Office\Outlook\Addins",
"HKLM:\Software\Wow6432Node\Microsoft\Office\Outlook\Addins",
"HKLM:\Software\Microsoft\Office\Outlook\Addins"
# Build up a list of add-ins by searching the specified paths
@dstreefkerk
dstreefkerk / Get-PerformanceCounter.ps1
Created February 18, 2016 00:19
A quick PowerShell function to extract Windows' list of performance counters and their corresponding IDs
function Get-PerformanceCounter
{
# Get the Performance Counters from the Registry
$counters = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009' -Name 'counter' | Select-Object -ExpandProperty Counter
# Remove the last line
$counters = $counters | Select-Object -SkipLast 1
# Split the string into an array
$counters = $counters.Split([Environment]::NewLine)