Skip to content

Instantly share code, notes, and snippets.

View NielsS79's full-sized avatar

Niels Scheffers NielsS79

View GitHub Profile
@NielsS79
NielsS79 / Add-PowerUser.ps1
Last active March 25, 2022 08:12
The first script creates a new, local account with administrator priveleges and stores its randomized password in an accessible location. The second script takes it all away again.
<#
.SYNOPSIS
This script creates a new, local account with administrator priveleges and stores its randomized password in an accessible location.
.DESCRIPTION
This script was developed to make sure power users have a seperate, local account to be used for elevated operations.
Please visit https://threeisacloud.tech/power-to-the-user/ for more information.
Configuration is done via the (few) variables below. I assume they are self-explanatory.
@NielsS79
NielsS79 / Set-WindowsOemProductKey.ps1
Last active June 10, 2023 18:19
Gets the product key stored in UEFI/BIOS and import it.
<#
.SYNOPSIS
Reads the Windows (OEM) product key from firmware (UEFI/BIOS), then imports it via slmgr.
.NOTES
"There are many like it, but this one is mine."
Author: Niels Scheffers <niels.scheffers@etesian.nl>
Last modified: 2022-03-10
#>
@NielsS79
NielsS79 / Find-AzureADDynamicGroupByQueryKeyword.ps1
Last active March 14, 2022 14:04
Find an Azure AD (Dynamic) group by a keyword in its membership query.
<#
.SYNOPSIS
This oneliner will fetch all Azure AD Dynamic Membership groups, matching a keyword to its membership query.
.DESCRIPTION
Get-AzureADMSGroup is basically Get-AzureADGroup via Graph API. It's more flexible but also a little tricky.
Using the -Filter below we only fetch groups where the GroupTypes property (collection) contains a 'DynamicMembership' value.
Unfortunately the contains() filter operator isn't implemented (there is startsWith() though) so we need to iterate over all results to find $SearchString matches.
.NOTES
@NielsS79
NielsS79 / Replace-AutopilotGroupTag.ps1
Last active July 12, 2022 11:48
Performs a find/replace operation on the group tag of Autopilot devices and (optionally) corrects dynamic group membership queries referencing it.
<#
.SYNOPSIS
Search and replace Windows Autopilot group tags over devices and dynamic group membership queries.
.DESCRIPTION
If you're like me, you'll frequently use Autopilot group tags to group devices in AAD groups. And, also if you're like me, you'll change your mind about the naming every so often.
This script will search and replace group tags assigned to devices _and_ correct your group membership queries in one go.
Set-AutopilotGroupTag and Get-AutopilotDevices are seperate helper functions, but you can use them as you wish. They are pretty straight-forward.
@NielsS79
NielsS79 / Set-OneDriveDocumentsFolder.ps1
Last active March 14, 2022 14:04
How to influence OneDrive's Known Folder Move and target specific cloud folders. Part of a blog series on https://allthingscloud.blog.
<#
.SYNOPSIS
Mark the OneDrive folder '\Documen-ta-daa' as the target for the 'Documents'-folder during KFM.
.DESCRIPTION
This script is part of the blog series on OneDrive's Known Folder Move and how to influence it.
Please visit https://allthingscloud.blog/onedrive-and-its-unknown-folder-move-kfm-part-1/ and https://allthingscloud.blog/onedrive-and-its-unknown-folder-move-kfm-part-2/ for more information.
.NOTES
Author: Niels Scheffers <niels.scheffers@etesian.nl>