Skip to content

Instantly share code, notes, and snippets.

View dotps1's full-sized avatar

Thomas Malkewitz dotps1

View GitHub Profile
@dotps1
dotps1 / ConvertFrom-Lovibond.ps1
Created November 2, 2017 19:49
Convert Lovibond to SRM.
<#PSScriptInfo
.Version
1.0
.Guid
bf215750-33c6-473e-8562-fbbd52d2e124
.Author
Thomas Malkewitz @dotps1
.Tags
Lovibond, SRM
Configuration Hypervisor {
Import-DscResource -ModuleName PSDesiredStateConfiguration
Node $AllNodes.NodeName {
WindowsFeatureSet RequiredFeatures {
Name = @(
"Failover-Clustering", "Hyper-V", "Multipath-IO"
)
Ensure = "Present"
@dotps1
dotps1 / readme.md
Last active August 26, 2017 15:27
BarcampGR 2017 Introduction to Jekyll

BarcampGR 2017 Introduction to Jekyll

This is an introduction to using Jekyll and GitHub Pages as a static page generator to help people who aren't web devs, be web devs.

This guide is constructed assuming you are developing on a Windows based platform.


Assumptions.

  1. You have some familiarity with the command line and command line tools.
@dotps1
dotps1 / WannaCryVulnerbilityTesting.ps1
Last active May 31, 2017 13:31
Test for WannaCry Vulns using PSJobs
#requires -module ActiveDirectory
# Input computers.
$threshold = (Get-Date).AddDays(-180)
$computers = Get-ADComputer -Filter { OperatingSystem -notlike "*server*" -and OperatingSystem -like "*windows*" -and PasswordLastSet -gt $threshold } |
Select-Object -ExpandProperty Name |
Sort-Object -Property Name
# Make sure there are not existing jobs.
Get-Job |
@dotps1
dotps1 / Set-ManageDocumentsPermission.ps1
Created January 23, 2017 19:46
Set Manage Documents permission on a Print Server.
# Get the SID of the group to give Permissions to.
$sid = ([System.Security.Principal.NTAccount]"DOMAIN\GROUPNAME").Translate(
[System.Security.Principal.SecurityIdentifier]
)
# Build an Access Control Entry object giving the group the Manage Documents permission. 983088 is the access mask for Manage Documents only.
$ace = New-Object -TypeName System.Security.AccessControl.CommonAce -ArgumentList @(
@([System.Security.AccessControl.AceFlags]::ObjectInherit, [System.Security.AccessControl.AceFlags]::InheritOnly), [System.Security.AccessControl.AceQualifier]::AccessAllowed, 983088, $sid, $false, $null
)
@dotps1
dotps1 / WinPENanoDomainJoin.ps1
Last active January 9, 2019 20:57 — forked from Ryan2065/WinPENanoDomainJoin.ps1
Nano domain join for use in SCCM task sequence!
$source = @'
using System;
using System.Security.Principal;
using System.Runtime.InteropServices;
namespace ECGCAT
{
public class Kernel32
{
[DllImport("Kernel32.dll", SetLastError = true)]
@dotps1
dotps1 / BattleNetClientFix.ps1
Created November 27, 2016 21:16
This will remove all the folders to allow you to log back into battle.net.
#requires -RunAsAdministrator
<#
.SYNOPSIS
This will remove all the folders to allow you to log back into battle.net.
.DESCRIPTION
This will remove all the folders to allow you to log back into battle.net.
.INPUTS
None
.OUTPUTS
@dotps1
dotps1 / ActiveSyncUserSync.ps1
Last active January 5, 2024 08:07
Sync Active Sync Users to group, and remove inactive devices.
$members = Get-ADGroupMember -Identity "ActiveSyncUsers"
foreach ($mailbox in (Get-CASMailbox -Filter { HasActiveSyncDevicePartnership -eq $true } -ResultSize Unlimited)) {
# If the user is disabled, remove all paired devices and ensure the user is removed from the group.
if ((Get-ADUser -Identity $mailbox.DistinguishedName).Enabled -eq $false) {
foreach ($device in (Get-MobileDevice -Mailbox $mailbox.DistinguishedName)) {
Remove-MobileDevice -Identity $device.Identity -Confirm:$false
}
if ($mailbox.DistinguishedName -in $members.DistinguishedName) {
Remove-ADGroupMember -Identity "ActiveSyncUsers" -Members $mailbox.DistinguishedName -Confirm:$false
@dotps1
dotps1 / .\Invoke-GitLabBuild.ps1
Created October 31, 2016 17:41
GitLab CI Files
#requires -Modules Configuration, Pester, PSScriptAnalyzer
[CmdletBinding()]
[OutputType()]
$ErrorActionPreference = "Stop"
try {
# Setup environment.
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Confirm:$false -Force |
@dotps1
dotps1 / Find-NthIndexOf.ps1
Last active January 5, 2024 08:07
Finds the nth index of a char in a string.
<#
.SYNOPSIS
Finds the nth index of a char in a string.
.DESCRIPTION
Finds the nth index of a char in a string, returns -1 if the char does not exist, or if nth is out of range.
.INPUTS
System.Char.
System.String.
System.Int.
.OUTPUTS