Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter van der Woude pvanderwoude

View GitHub Profile
View Remediate-LocalAdministrators.ps1
#Define variables
$currentUser = (Get-CimInstance Win32_ComputerSystem).Username -replace '.*\\'
$localAdministrators = @("[YourGlobalAdminRoleSid]","[YourDeviceAdminRoleSid]") #Adjust to your local administrators
try {
$administratorsGroup = ([ADSI]"WinNT://$env:COMPUTERNAME").psbase.children.find("Administrators")
$administratorsGroupMembers = $administratorsGroup.psbase.invoke("Members")
foreach ($administratorsGroupMember in $administratorsGroupMembers) {
$administrator = $administratorsGroupMember.GetType().InvokeMember('Name','GetProperty',$null,$administratorsGroupMember,$null)
if (($administrator -ne "Administrator") -and ($administrator -ne $currentUser)) {
View Detect-LocalAdministrators.ps1
#Define variables
$localAdministrators = @()
$memberCount = 0
$numberLocalAdministrators = 4 #Adjust to your number of administrators
try {
$currentUser = (Get-CimInstance Win32_ComputerSystem).Username -replace '.*\\'
$administratorsGroup = ([ADSI]"WinNT://$env:COMPUTERNAME").psbase.children.find("Administrators")
$administratorsGroupMembers= $administratorsGroup.psbase.invoke("Members")
foreach ($administrator in $administratorsGroupMembers) {
View New-SettingsTemplate.ps1
function Update-PolicySetting {
<#
.SYNOPSIS
A simple function to update policy settings by using MDM WMI Bridge
.DESCRIPTION
This function provides the capability to adjust policy settings by using the MDM WMI Bridge.
It supports the capabilities to create, update and remove an instance
.PARAMETER className
This parameter is required for the name of the WMI class
.PARAMETER parentID
View Set-ChromeEnrollmentToken.ps1
<#
.SYNOPSIS
Configure the Google Chrome Cloud Management enrollment token.
.DESCRIPTION
This script adds a registry key that will set the Google Chrome Cloud Management enrollment token to enable the cloud-based management of the browser.
.NOTES
Author: Peter van der Woude
Contact: pvanderwoude@hotmail.com
Date published: 22-04-2020
Current version: 1.0
View Install-ChocoApps.ps1
<#
.SYNOPSIS
Install Chocolatey packages.
.DESCRIPTION
This script will install Chocolatey packages and provide notifications to the user after succesful installation.
.NOTES
Author: Peter van der Woude
Contact: pvanderwoude@hotmail.com
Date published: 17-04-2019
View Enable-WindowsSandbox.ps1
<#
.SYNOPSIS
Enable Windows Sandbox.
.DESCRIPTION
This script will simply enable the Windows Sandbox for the user.
.NOTES
Author: Peter van der Woude
Contact: pvanderwoude@hotmail.com
Date published: 07-01-2019
Current version: 1.0
View Install-ChromeExtension.ps1
<#
.SYNOPSIS
Install Chrome and create the registry key to trigger installation of Chrome extension.
.DESCRIPTION
This script installs Google Chrome by using Chocolatey and creates the registry key that will trigger the installation of the Chrome extension.
This script is created for usage with Microsoft Intune, which doesn't support parameters yet.
.NOTES
Author: Peter van der Woude
Contact: pvanderwoude@hotmail.com
Date published: 02-07-2018
You can’t perform that action at this time.