Skip to content

Instantly share code, notes, and snippets.

@HighLibrarian
HighLibrarian / get-workinghours.ps1
Created July 1, 2025 10:03
get working hours in the current month
$HoursPerDay = 8
# get our current date
$StartDate = get-date
# get the first day of the current month, then add 1 month the get the next month, and subtract 1 day
# this will give you the last day of the current mont
$EndDate = (get-date -day 1).AddMonths(1).AddDays(-1)
$WorkingDays = 0
@HighLibrarian
HighLibrarian / MyPowerShellProfile.ps1
Last active May 20, 2025 09:51
DailyPowerShellProfile
<#
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@#-:**************=*@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-%+=%%%%%%%%%%%%%%-#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%##%%%%%%%%%%%%%%%%%%%%%%%:*%%=+%%%%%%%%%%%%%%.#@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%#@%%%%%%%%%%%%%%%%%%@%%*#@%%@+%%%%%%%%%%%%%%%+%@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command":
{
"action": "copy",
"singleLine": false
@HighLibrarian
HighLibrarian / New-DifferencingVm.ps1
Last active December 16, 2024 11:09
New-DifferencingVm
function New-DifferencingVm
{
param (
[Parameter(Mandatory=$true)]
[string]$VMName,
[Parameter(Mandatory=$false)]
[string]$DiskName=$VMName,
[Parameter(Mandatory=$false)]
@HighLibrarian
HighLibrarian / Set-GoDaddyDnsRecord.ps1
Created November 28, 2024 13:48
GoDaddy update DNS
<#
This script is used to check and update your GoDaddy DNS server to the IP address of your current internet connection.
First go to GoDaddy developer site to create a developer account and get your key and secret
https://developer.godaddy.com/getstarted
Update the first 4 varriables with your information
#>
$domain = '' # your domain
$key = '' #key for godaddy developer API
@HighLibrarian
HighLibrarian / ObsidianToHugo.ps1
Created May 14, 2024 13:02
This script preps obsidian notes for Hugo usage
# ______ __ _
# / ____/_ ______ _____/ /_(_)___ ____ _____
# / /_ / / / / __ \/ ___/ __/ / __ \/ __ \/ ___/
# / __/ / /_/ / / / / /__/ /_/ / /_/ / / / (__ )
# /_/ \__,_/_/ /_/\___/\__/_/\____/_/ /_/____/
function Get-YamlFrontMatter
{
param
@HighLibrarian
HighLibrarian / start-IntuneDeviceSync.ps1
Last active April 16, 2024 08:18
makes intune devices sync their policies
$GroupId = "bc8b6f66-fd59-412f-9b2e-1a0de52466a5"
# Importing the SDK Module
Import-Module -Name Microsoft.Graph.DeviceManagement.Actions
Connect-MgGraph -scope DeviceManagementManagedDevices.PrivilegedOperations.All, DeviceManagementManagedDevices.ReadWrite.All,DeviceManagementManagedDevices.Read.All
#### Gets All devices
$Devices = Get-MgGroupMember -GroupId $GroupId
Foreach ($Device in $Devices)
@HighLibrarian
HighLibrarian / Add-DevicesToEntraIdGroup.ps1
Created April 16, 2024 07:59
Add-DevicesToEntraGroup
$GroupId = ""
$devicelist = get-content .\devicelist.csv | ConvertFrom-Csv
foreach ($device in $devicelist)
{
write-host "adding $($device.devicename) to our group"
$DeviceID = $device.MicrosoftEntradeviceID
$EntraDeviceID = Get-MgDevice -Filter "DeviceId eq '$DeviceID'" | Select-Object -ExpandProperty id
New-MgGroupMember -groupid $GroupId -DirectoryObjectId $EntraDeviceID
@HighLibrarian
HighLibrarian / Clear-GroupPolicyCache.ps1
Last active March 26, 2024 11:13
Clear-GroupPolicyObjectCache.ps1
<#
.SYNOPSIS
This script clears the local GPO cache for both user and device levels using remove-item commands.
.DESCRIPTION
This script clears the local GPO cache for both user and device levels using remove-item commands.
It stops any ongoing transcript, starts a new transcript for logging purposes, clears the GPO cache,
and then starts a new transcript for logging purposes.
.NOTES
Author: BDW
Date: 26/03/2024
<#
.SYNOPSIS
Retrieves information about installed applications based on different search modes.
.DESCRIPTION
The Get-InstalledApps function retrieves information about installed applications based on various search modes
such as Registry, CmCIM, or File. It allows querying by application name, version, and search mode.
.PARAMETER Appname
The name of the application to search for.
.PARAMETER Version
The version of the application to search for.